can't read binary files containg '0x0' character
| From: | Roland Divin | Date: | Fri, 12 Oct 2001 19:00:24 +0000 |
| Subject: | can't read binary files containg '0x0' character | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-9827@lists.php.net to get a copy of this message | ||
Hi,
I can'r read binary file that contains '0x0' character. Reading process
stops after reading '0x0' character on windows version of PHP. On Linux it
does not.
That same code gives another result on windows then on linux. Why?
(Consider file text.txt is contaning '0x0' characters. I'm using PHP4 build
from Jun 22 2001.)
$filename = "text.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
echo $contents;
echo strlen($contents);
for($i=0;$i<strlen($contents);$i++)
{ echo "$i:".ord($contents[$i])."<br>"; }
Isn't it bug?
Thanks
Roland Divin