or read the original file into memory, reopen the file for writing, write
the first prepend bit, then write what you just read

-----Original Message-----
From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 1:18 PM
To: John Smythe
Subject: Re: [PHP] fopen

On Thu, 2002-02-14 at 17:34, John Smythe wrote:
> i wanna know if there is a way of opening a file in a certian mode so when
i write to a txt file it writes at the top of the file, and doesnt overwrite
whats at the start of the file

No, not with fopen(). What you can do is create a temporary file with 
tempnam(), write the new data to that, *append* the data from the
original file, and rename the temp file over the original file.



> Regards,
> John Smythe
> http://www.smythey.org/  
 Torben Wilson <[EMAIL PROTECTED]>

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to