note 27170 added to function.fgetc
| From: | variable at thefragile dot com | Date: | Mon, 25 Nov 2002 23:43:50 +0000 |
| Subject: | note 27170 added to function.fgetc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39966@lists.php.net to get a copy of this message | ||
For some reason fgetc doesn't like printing out the character 0 (zero) and will skip it
completely if you're parsing a text file. Perhaps it's just dodgy only for me, but
i've had to work around it thusly:
while (($c = fgetc($file)) || ($c == 0)) {
if ($c == "\t") { echo " <B>tab</B> "; }
if ($c == "\n") { echo "newline<BR>"; }
else { echo "$c"; }
}
Someone please tell me, if possible, why i need the extra OR || statement in there to make it print
zeroes
---- Dinger
--
http://www.php.net/manual/en/function.fgetc.php
http://master.php.net/manage/user-notes.php?action=edit+27170
http://master.php.net/manage/user-notes.php?action=delete+27170
http://master.php.net/manage/user-notes.php?action=reject+27170