note 38848 added to function.fgetc
| From: | number_co at yahoo dot com | Date: | Thu, 08 Jan 2004 20:53:11 +0000 |
| Subject: | note 38848 added to function.fgetc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-63167@lists.php.net to get a copy of this message | ||
Unfortunately, if you do it the way you have written (from 05-Dec-2002 07:23):
$c = fgetc($f);
while($c != 'X') fputs($f, $c); fclose($f);
either it will not echo the character at all, or it will do it an infinite number of times (i.e. go
into an infinite loop). The proper way to do it is like this:
$c = fgetc($f);
while($c != 'X') {
fputs($f, $c);
$c = fgetc($f);
}
fclose($f);
----
Manual Page -- http://www.php.net/manual/en/function.fgetc.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38848
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38848&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38848&report=yes
Search -- http://master.php.net/manage/user-notes.php