note 39913 added to function.fseek

From: Date: Sun, 15 Feb 2004 16:27:44 +0000
Subject: note 39913 added to function.fseek
Groups: php.notes 
Request: Send a blank email to php-notes+get-65171@lists.php.net to get a copy of this message
I think the function should be as following to deal any combination of cr & lf, no matter the line ends by cr, lf, cr-lf or lf-cr: function getline ($handle) { while (!feof($handle)) { $char = fgetc($handle); if (($char == "\n") or ($char == "\r")) { $char2 = fgetc($handle); if (($char2 != "\n") && ($char2 != "\r")) { fseek ($handle,-1,SEEK_CUR); } break; } else { $buffer .= $char; } } return $buffer; } ---- Manual Page -- http://www.php.net/manual/en/function.fseek.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39913 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39913&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39913&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65171) next »