Re: can't read binary files containg '0x0' character

From: Date: Fri, 12 Oct 2001 19:33:15 +0000
Subject: Re: can't read binary files containg '0x0' character
References: 1 2  Groups: php.windows 
Request: Send a blank email to php-windows+get-9830@lists.php.net to get a copy of this message
Thanks, you're right. Now it works even using dll module (not CGI) version. Anyway it is strange that the behavior of the fread function is conditioned whether I use dll module or CGI... Roland "Mark" <maggelet@mminternet.com> píse v diskusním príspevku news:200110121918.f9CJIEr06509@zeus.mminternet.net... 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

« previous php.windows (#9830) next »