[PHP] Re: binary file + fread

2002-01-27 Thread Michael Agbaglo



[...]

> $fd = fopen( $filename, "rb" ); //Notice the "b"
> $a = fread( $fd, 4 );
> $b = fread( $fd, 4 );
> printf( "a= %lx b=%lx", $a, $b);
> fclose( $fd );
> ?>
> 
> notice the "b" in the fopen, it stand for binary.
[...]


I noticed the 'b' like in but - it's also mentioned in the 
documentation, BUT it doesn't seem to work !


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: binary file + fread

2002-01-27 Thread Paul A. Procacci

Try


notice the "b" in the fopen, it stand for binary.

Paul

Michael Agbaglo wrote:

> Hi !
>
> I've some trouble w/ the following peace of code... Althoug the file
> doesn't contain zeros at the beginning the output is
> a= 0 b=0
>
> Is there a problem w/ fread ? (php 4.0.6, RedHat 7.2)
>
>  $filename = "/export/html/log";
> $fd = fopen( $filename, "r" );
> $a = fread( $fd, 4 );
> $b = fread( $fd, 4 );
> printf( "a= %lx b=%lx", $a, $b);
> fclose( $fd );
> ?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]