Re: opening tex file

From: Date: Fri, 17 Jan 2003 13:49:26 +0000
Subject: Re: opening tex file
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-131999@lists.php.net to get a copy of this message
At 14:05 17-1-2003, you wrote:
On Friday 17 January 2003 20:59, Artur Bereœniewicz wrote: how can I open text file and start reading in the middle of it? AFAIK it's not possible to jump directly into the middle of a file and start reading. You would have to read it line-by-line until you get to the part you're interested in. If the file isn't large (say less than several MBs) then just read it all into an array using file() and process it from there.
Well why not try something like this <?PHP $filename="halffile.txt"; $fp=fopen("$filename","r"); fseek($fp,$numpoint); //jump to midfile $middle_of_file=(filesize($filename))/2; echo "\n".$middle_of_file; $precontent=fread($fp,$middle_of_file); $content=fread($fp,filesize("$filename")); fclose($fp); echo nl2br($content); exit(); ?>

« previous php.general (#131999) next »