note 51831 added to function.gzseek
| From: | dperham at wgate dot com | Date: | Tue, 12 Apr 2005 15:47:52 +0000 |
| Subject: | note 51831 added to function.gzseek | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87910@lists.php.net to get a copy of this message | ||
PHP/4.3.9
contrary to the notes, gzseek() returns -1 if I try to seek past the end of the file. here is a
function that will return the last seekable position, and put the file pointer there.
/** sets the file pointer at the end of the file
* and returns the number of bytes in the file.
*/
function gzend($fh)
{
$d = 1<<14;
$eof = $d;
while ( gzseek($fh, $eof) == 0 ) $eof += $d;
while ( $d > 1 )
{
$d >>= 1;
$eof += $d * (gzseek($fh, $eof)? -1 : 1);
}
return $eof;
}
----
Manual Page -- http://www.php.net/manual/en/function.gzseek.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51831
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51831&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51831&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51831&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51831&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51831&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51831&report=yes
Search -- http://master.php.net/manage/user-notes.php