note 112646 added to function.fseek

From: Date: Tue, 09 Jul 2013 09:12:00 +0000
Subject: note 112646 added to function.fseek
Groups: php.notes 
Request: Send a blank email to php-notes+get-195538@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: 69.147.83.199 Probable Submitter: 122.173.173.167 ---- Manual Page -- http://php.net/manual/en/function.fseek.php Edit -- https://master.php.net/note/edit/112646 Del: integrated -- https://master.php.net/note/delete/112646/integrated Del: useless -- https://master.php.net/note/delete/112646/useless Del: bad code -- https://master.php.net/note/delete/112646/bad+code Del: spam -- https://master.php.net/note/delete/112646/spam Del: non-english -- https://master.php.net/note/delete/112646/non-english Del: in docs -- https://master.php.net/note/delete/112646/in+docs Del: other reasons-- https://master.php.net/note/delete/112646 Reject -- https://master.php.net/note/reject/112646 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195538) next »