note 55710 added to function.fgets
| From: | Jeff at osu1 dot php dot net | Date: | Thu, 11 Aug 2005 07:38:01 +0000 |
| Subject: | note 55710 added to function.fgets | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-93414@lists.php.net to get a copy of this message | ||
Just wanted to point out that you can do a priming read on the data file outside a while statement
to get your data to act on;
<?php
$handle = fopen("some_file", "r");
$buffer = fgets($handle, 4096);
while (!feof($handle)) {
echo $buffer;
}
?>
Then when you enter the while loop (if you do) you have data already waiting for you to act on.
----
Manual Page -- http://www.php.net/manual/en/function.fgets.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55710
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55710&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55710&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55710&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55710&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55710&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55710&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55710&report=yes
Search -- http://master.php.net/manage/user-notes.php