On 05-Jul-01 James Bartlett wrote:
> Hi,
> 
> Anyone know how I can write and read to different lines in a file rather
> than just adding to the text already on the first line of the file?
> 
> Thanks
> 

Assuming you're talking about text files:

A. suck the whole thing up in memory, change it there, write it back out.
B. open a temp, copy till the line of interest, write your change,
   copy remainder. mv/cp the temp to the original.
C. read to line of interest, ftell(), suck remainder into memory.
   ftruncate(), fseek(), write your changes, write out the remainder.

Regards, 
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to