Hi all..
I have a program I wrote that outputs abnormal program activity to a text file.
Example: Say user tries to choose a non-existant path:
message= "Path error encountered."
Goes to a sub called logme:
sub logme
open "errorlog.txt" for append as #1
print #1, message
close 1
Pretty simple I know.
But what if I wanted to limit the errorlog.txt file size to 100 entries?
Is there a simple way to delete entry #1 when entry #101 is made?
Currently program counts the number of lines in the file before writing to it. If over 100 then it copies everything except entry #1 to another file (erorlog.tmp). It then adds entry 101 to errorlog.tmp.
It then deletes errorlog.txt, renames errorlog.tmp to errorlog.txt. This results in 100 entries, first in-first out.
There has got to be a cleaner way to do this, and I know you are the guys to ask.
Thanks.
I have a program I wrote that outputs abnormal program activity to a text file.
Example: Say user tries to choose a non-existant path:
message= "Path error encountered."
Goes to a sub called logme:
sub logme
open "errorlog.txt" for append as #1
print #1, message
close 1
Pretty simple I know.
But what if I wanted to limit the errorlog.txt file size to 100 entries?
Is there a simple way to delete entry #1 when entry #101 is made?
Currently program counts the number of lines in the file before writing to it. If over 100 then it copies everything except entry #1 to another file (erorlog.tmp). It then adds entry 101 to errorlog.tmp.
It then deletes errorlog.txt, renames errorlog.tmp to errorlog.txt. This results in 100 entries, first in-first out.
There has got to be a cleaner way to do this, and I know you are the guys to ask.
Thanks.