On Thu, 21 Mar 2002, Mauricio Sthandier wrote:
> I guess thist must be really silly... but how can I append text to the
> beginning of a file ???
> I've been trying since a while... but all I get is overwriting !.

Open a temporary file, write your new data to it, copy the old file on to 
the end of it, remove the old file, rename the temporary file with the old 
file's name.

Obviously this is not very efficient. Explore whether you really need to
prepend. Perhaps you can append and then read the file backwards a la tac?  
Or perhaps a database is more useful. Or multiple files.

miguel


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

Reply via email to