Can anyone tell me if there is an advantage to writing to a text file between the following two methods:
( I am writing some logging messages during program operation )
(The obvious here is that method 2 seems simpler. but what about reliability or performance?)
method 1
------------------------
tcFile = "logfile.log"
strNewString = "some text here"
IF FILE(tcFile) && Does file exist?
jnH = FOPEN(tcFile,12) && If so, open write only un-buffered
fseek( jnh, 0, 2) && move to end of file
ELSE
jnH = FCREATE(tcFile) && If not, create it
ENDIF
IF jnH < 1 && Check for error opening file
WAIT 'Cannot open or create log file' WINDOW NOWAIT
ELSE && If no error, write to file
Fputs(jnH, strNewString)
ENDIF
FCLOSE(jnH) && Close file
method 2
------------------------
strNewString = "some text here"
Set TextMerge On NoShow
Set TextMerge To "logfile.log" Additive
\<
>
Set TextMerge To
Set TextMerge Off
Thanks
- best regards, Robert