Write in the same file many different times

Hi everyone,

I had a requirement from a customer where I have to create a log file for a batch treatment.
I used the following code to create and write in the file (for each execution, a file will be created):

LogFile.CREATETEMPFILE();
LogFile.TEXTMODE(TRUE);
LogFile.WRITE('xxx');
LogFile.CREATEINSTREAM(NewStream);
FileName := STRSUBSTNO(Textxxx,WORKDATE);
DOWNLOADFROMSTREAM(NewStream,'','<TEMP>', '',MagicPath);
CREATE(FileSystemObject,TRUE,TRUE);
FileSystemObject.CopyFile(MagicPath,FileName);
FileSystemObject.DeleteFile(MagicPath,TRUE);

The customer now wants to have a unique log file, meaning that the errors have to be appended each time in the same file.
How should I modify my code to get this requirement done?

Thanks in advance :mrgreen:

Please check this blog, it may help you

http://mibuso.com/blogs/mohana/2011/09/11/how-to-create-a-text-file-and-writeappend-text-into-the-file