note 100129 added to function.fseek
| From: | sylvain at abstraction dot fr | Date: | Mon, 27 Sep 2010 12:51:31 +0000 |
| Subject: | note 100129 added to function.fseek | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172732@lists.php.net to get a copy of this message | ||
seeking past PHP_INT_MAX.
<?php
function fseek64(&$fh, $offset)
{
fseek($fh, 0, SEEK_SET);
if ($offset <= PHP_INT_MAX)
{
return fseek($fh, $offset, SEEK_SET);
}
$t_offset = PHP_INT_MAX;
$offset = $offset - $t_offset;
while (fseek($fh, $t_offset, SEEK_CUR) === 0)
{
if ($offset > PHP_INT_MAX)
{
$t_offset = PHP_INT_MAX;
$offset = $offset - $t_offset;
}
else if ($offset > 0)
{
$t_offset = $offset;
$offset = 0;
}
else
{
return 0;
}
}
return -1;
}
?>
----
Server IP: 89.31.146.176
Probable Submitter: 82.138.94.34
----
Manual Page -- http://www.php.net/manual/en/function.fseek.php
Edit -- https://master.php.net/note/edit/100129
Del: integrated -- https://master.php.net/note/delete/100129/integrated
Del: useless -- https://master.php.net/note/delete/100129/useless
Del: bad code -- https://master.php.net/note/delete/100129/bad+code
Del: spam -- https://master.php.net/note/delete/100129/spam
Del: non-english -- https://master.php.net/note/delete/100129/non-english
Del: in docs -- https://master.php.net/note/delete/100129/in+docs
Del: other reasons-- https://master.php.net/note/delete/100129
Reject -- https://master.php.net/note/reject/100129
Search -- https://master.php.net/manage/user-notes.php