RE: How to make binary strings useful?

From: Date: Wed, 02 Feb 2005 21:46:24 +0000
Subject: RE: How to make binary strings useful?
Groups: php.general 
Request: Send a blank email to php-general+get-207937@lists.php.net to get a copy of this message
Here's the code (with the domain name removed) that doesn't work, "despite" the poor documentation of the variable types: <? $dir = "/home/<domain_name>/www/binary/"; $dh = opendir ($dir); do { $file = readdir ($dh); } while (!strncmp ($file, ".", 1)); $filename = sprintf ("%s%s", $dir, $file); $fh = fopen ($filename, "r"); $cont = fread ($fh, 4); echo "file:<BR>"; echo $filename; echo "<BR>cont:<BR>"; printf ("%02x %02x %02x %02x", $cont{0}, $cont{1}, $cont{2}, $cont{3}); fclose ($fh); closedir ($dh); ?> Here's the output of "od -c glance_date" up to the fourth byte: 0000000 177 E L F All four bytes are non-zero!

« previous php.general (#207937) next »