Re: can't read binary files containg '0x0' character
| From: | Mark | Date: | Thu, 11 Oct 2001 19:15:58 +0000 |
| Subject: | Re: can't read binary files containg '0x0' character | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-9829@lists.php.net to get a copy of this message | ||
On Fri, 12 Oct 2001 21:00:24 +0200, Roland Divin wrote:
>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");
should be "rb" for binary files.
>$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
>
>
>
--
Mark, maggelet@mminternet.com on 10/11/01