|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-04-18 17:29 UTC] joshbuddy at hotmail dot com
obviously feof will not work on a Bz file handle (though it would be nice if it did)
the only way i could find it detect the end in a loop (where you would be slurping in the whole file) is:
// open the file ... $bzfile
$data="";
$string=bzread($bzfile,4096);
while ($string!=str_repeat("\0",4096)) {
$data.=$string;
$string=bzread($bzfile,4096);
}
a better mechanism for eof detection is needed
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
Err, scratch that last comment; the only way to detect eof for bzip streams is to keep reading it. feof will always return false for bz2. Your bzread or fread call should return false when no more data can be read. while(($string = bzread($bzfile, 4096)) !== false) { ... } should do what you want.