I have made a standalone on a windows machine that (amongst other things) creates a log file of its own activity. The program is designed to work automatically in a remote location over a period of months or years. Basically the log file records when the program boots and quits, when a MIDI file starts and stops playing, when a user changes settings etc.
Because the computer is in a remote setting, the log file is important to verify that things are working alright. It gets rewritten as a uniquely-named file once a week.
I have made a logging subpatch using the text object, but it is not particularly robust. What it does is: write to temp file when program quits, load temp file again when program loads, append to ram when event occurs, re-write to temp file when program quits again. The temp file is renamed once a week to become 'permanent'.
Sometimes the info gets lost in ram-land (this happens when using remote access while a midi file is playing, but that's not what I'm writing about) and so the whole log (up to that day of the week) is lost because it has to read the whole file and write the whole thing back again to disk.
One way around this is to only open the file when a logging event occurs, append using the text object and write to file again, but there is still the danger of the whole file being corrupted while it is ram.
What i would like is an 'append-to-file' mode for the text object so that it appends directly to the disk file rather than having to load all the info into ram, just to append one line.
Am I missing something obvious here?
Thanks for comments or suggestions.