View Full Version : writing text to the end of a file

12 December 2003, 04:54 PM
Hi there.

Im trying to write data to the end of a text-file, beneath the old text.
But it seems that the text thats already in the file gets written over if I use the fprint function,

How should I solve this?

thanks for any help.


12 December 2003, 06:39 PM
When you open your file for writing, using fopen , make sure you are opening the file for "append", like so:

string $myFile = "C:\\TestFile.txt";
$fileID = `fopen $myFile "a"`;

See if that doesn't work for you.

12 December 2003, 06:57 PM
ahh thanks. great!
that was exactly what I wanted.
I was only looking at the print commad in the docs, forgot about open.

CGTalk Moderation
01 January 2006, 08:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.