API16:JStream/gets
From Joomla! Documentation
Syntax
gets($length=0)
| Parameter Name | Default Value | Description |
|---|---|---|
| $length | 0 |
Defined in
libraries/joomla/filesystem/stream.php
Importing
jimport( 'joomla.filesystem.stream' );
Source Body
function gets($length=0)
{
if(!$this->_fh)
{
$this->setError(JText::_('File not open'));
return false;
}
$retval = false;
// Capture PHP errors
$php_errormsg = 'Error Unknown';
$track_errors = ini_get('track_errors');
ini_set('track_errors', true);
switch($this->processingmethod)
{
case 'gz':
$res = $length ? gzgets($this->_fh, $length) : gzgets($this->_fh);
break;
case 'bz':
case 'f':
default:
$res = $length ? fgets($this->_fh, $length) : fgets($this->_fh);
break;
}
if(!$res) {
$this->setError($php_errormsg);
} else {
$retval = $res;
}
// restore error tracking to what it was before
ini_set('track_errors',$track_errors);
// return the result
return $retval;
}
Examples
Code Examples