note 17029 added to function.fread
| From: | stefan dot priebsch_AT_e-novative dot de at php2 dot chek dot com | Date: | Thu, 22 Nov 2001 17:30:19 +0000 |
| Subject: | note 17029 added to function.fread | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21172@lists.php.net to get a copy of this message | ||
Seems like the strings returned from fread always have the length "number of characters to
read". Try this on your favourite file:
clearstatcache ();
$FileHandle = fopen ($FileNameAndPath, "rb");
$b = 0;
while ($Block = fread ($FileHandle, 8192))
{
$b += strlen ($Block);
}
print "file size: ".filesize ($FileNameAndPath)."<br>";
print "read: $b<br>";
fclose ($FileHandle);
On my W2K the two numbers will differ, the number of bytes read
always being a multiple of 8192. You can also look at the strlen of
each block that is read - you'd expect the last one usually *not* to
have a size of 8192, but it does.
Is this to be considered a bug or a feature?
Steve
--
http://www.php.net/manual/en/function.fread.php
http://master.php.net/manage/user-notes.php?action=edit+17029
http://master.php.net/manage/user-notes.php?action=delete+17029
http://master.php.net/manage/user-notes.php?action=reject+17029