note 110624 modified in function.fseek by danbrown
| From: | danbrown@php.net | Date: | Thu, 06 Dec 2012 14:17:00 +0000 |
| Subject: | note 110624 modified in function.fseek by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192316@lists.php.net to get a copy of this message | ||
SOLUTION FOR BIG FILES (2GB SEEK BUGFIX)
when you using files larger than 2gb
you are in big fail with standard solution like:
fseek($fs,4*1024*1024*1024); // 4GB
<?php
//But this work perfect:
while(!feof($fs)){
echo ''.($i++).'<br/>';
$data = fread($fs,$package);
}
//its follow to use this solution for 2gb+ files read:
for($i=0;$i<$page;$i++){
fseek($fs,$package_len,SEEK_CUR);
}
?>
good luck for all :)
--was--
SOLUTION FOR BIG FILES (2GB SEEK BUGFIX)
when you using files larger than 2gb
you are in big fail with standard solution like:
fseek($fs,4*1024*1024*1024); // 4GB
//But this work perfect:
while(!feof($fs)){
echo ''.($i++).'<br/>';
$data = fread($fs,$package);
}
//its follow to use this solution for 2gb+ files read:
for($i=0;$i<$page;$i++){
fseek($fs,$package_len,SEEK_CUR);
}
good luck for all :)
http://php.net/manual/en/function.fseek.php