note 38848 deleted from function.fgetc by didou
| From: | didou@php.net | Date: | Thu, 08 Jan 2004 21:16:55 +0000 |
| Subject: | note 38848 deleted from function.fgetc by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63169@lists.php.net to get a copy of this message | ||
Note Submitter: number_co@yahoo.com
----
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);