fread + binary file
| From: | Michael Agbaglo | Date: | Sun, 27 Jan 2002 10:59:58 +0000 |
| Subject: | fread + binary file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-82293@lists.php.net to get a copy of this message | ||
Hello !
I've some tourble w/ the following piece of code. The file to read doesn't contain zeros at the beginning, but the output is
a= 0 b=0
is there a problem w/ fread ? (php 4.0.6, RedHat 7.2)
<?php
$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 );
?>