note 112647 added to function.fseek

From: Date: Tue, 09 Jul 2013 09:14:25 +0000
Subject: note 112647 added to function.fseek
Groups: php.notes 
Request: Send a blank email to php-notes+get-195539@lists.php.net to get a copy of this message
how to read BIG files using fseek (above 2GB+, upto any size like 4GB+, 100GB+, 100 terabyes+, any file size, 100 petabytes, max limit is php_float_max ) ? // seek / set file pointer to 50 GB my_fseek($fp, floatval(50000000000),1); function my_fseek($fp,$pos,$first=0) { // set to 0 pos initially, one-time if($first) fseek($fp,0,SEEK_SET); // get pos float value $pos=floatval($pos); // within limits, use normal fseek if($pos<=PHP_INT_MAX) fseek($fp,$pos,SEEK_CUR); // out of limits, use recursive fseek else { fseek($fp,PHP_INT_MAX,SEEK_CUR); $pos -= PHP_INT_MAX; my_fseek($fp,$pos); } } hope this helps. ---- Server IP: 59.162.86.123 Probable Submitter: 122.173.173.167 ---- Manual Page -- http://php.net/manual/en/function.fseek.php Edit -- https://master.php.net/note/edit/112647 Del: integrated -- https://master.php.net/note/delete/112647/integrated Del: useless -- https://master.php.net/note/delete/112647/useless Del: bad code -- https://master.php.net/note/delete/112647/bad+code Del: spam -- https://master.php.net/note/delete/112647/spam Del: non-english -- https://master.php.net/note/delete/112647/non-english Del: in docs -- https://master.php.net/note/delete/112647/in+docs Del: other reasons-- https://master.php.net/note/delete/112647 Reject -- https://master.php.net/note/reject/112647 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195539) next »