Actions

API16

JStream/gets

From Joomla! Documentation

< API16:JStream
Revision as of 17:47, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

[Edit Descripton]

Description:JStream/gets

Contents

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;
}

[Edit See Also] SeeAlso:JStream/gets

Examples

<CodeExamplesForm />