There's no APPEND function per se. BN2 has a very good suggestion that is leaving the file open until you are done writing the file for the whole session. Then close after everything is finished.
I think BN2 meant to test if the file didn't exist before writing to it:
if file exist(date$+"log")
=0 then open to write 2, date$+" log"
Or, you can manage the appending yourself. It seems that you are storing strings in your file. That makes things nice and easy. When you write a string to a file, each line ends with a carriage return and a line feed. This means there is a way to count the number of lines in the file. This means that the file can be looked at as an array. An array is a list of values. Since each line in our file ends with a certain number (13 for carriage return and 10 for a line feed), by counting the carriage returns (or the line feeds) we can get a count of how many lines are in the file. That gives us a size for an array to dimension.
Why am I talking about arrays? Well, we can make the storage and retrieval of the log file very easy by saving and loading the file as an array. The beauty of this is, once we get the count of the lines, we can DIMension our array a little bigger so we can add another log entry to it. Then we just save the whole array back to the log file with the new entry.
How do we get the count of the lines? We OPEN TO READ the file, then read each byte. We'll just count carriage returns so we check if the byte value is equal to 13. If it is, we increase our count.
Once we have read the entire file and have the count, we dimension the array to this size:
DIM log$(count)
We load the file into the array:
load array date$,log$(count)
We add the new entry
log$(count)=get time$()+action$
Then save the array
save array date$,log$(count)
A few things to note:
All file operations run much faster if you have used SYNC ON at the beginning of your program. It took about .394 sec to read a 6500 line file in some tests I ran with SYNC ON called some time ahead and it took 5 secs without it.
get date$() returns a string with slashes "/" in it. Don't save the file with that name because slashes are file operation characters and can cause problems under certain conditions if in the filename. You can remove or replace the slashes using a for next loop, and mid$().
Arrays start counting at 0, that's why we can redimension the array with just the count that is returned from the open to read part. By DIMensioning the log$() to count, we actually have one more element than the size of the file.
The first time creating a log for a particular date, the file will not exist. You'll have to test for this condition and create your log array as
count=0
DIM log$(count)
Then update it and save it just like the above.
I wrote up a complete function that does all of this just to test out the idea and it works great. See if you can do the same.
Enjoy your day.