php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9173 getline
Submitted: 2001-02-08 09:47 UTC Modified: 2003-02-09 14:47 UTC
From: amandato at unitedmcgill dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4pl1 OS: windowsNT
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: amandato at unitedmcgill dot com
New email:
PHP Version: OS:

 

 [2001-02-08 09:47 UTC] amandato at unitedmcgill dot com
Add a getline feature to the file and string routines.  is it possible to incorporate the iostream style stdin/stdout in php? 

this is the getline i wrote:

function getline( $fp, $delim )
{
    $result = "";
    while( !feof( $fp ) )
    {
        $tmp = fgetc( $fp );
        if( $tmp == $delim )
            return $result;
       $result .= $tmp;
    }
    return $result;
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-08 10:02 UTC] cynic@php.net
please, read the manual: fgets does what you want.
 [2001-02-08 10:19 UTC] cynic@php.net
user feedback:
***************
getline in C++ does not limit the delim character with just a newline.  if I wanted, I could do a getline on a string stream where the line ends with "|".  example:

strstream sin;
sin.getline( szBuffer, nLength, '|' );

I would think this would be highly useful.  It is just a suggested feature to add.
Also, with getline, it does not return the delim "|" character in the szBuffer.
***************

ok, re-opened
 [2003-02-09 14:47 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

PHP5-dev
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC