View previous topic :: View next topic |
Author |
Message |
flypaper Contributor
Joined: 19 Oct 2001 Posts: 104
|
Posted: Sat Mar 09, 2002 1:08 pm Post subject: Is there an easier way to write a log file than this? |
|
|
I've come up with two ideas, both don't really seem to fit. One way was to write the log as an .ini file. This just seems kinda ghetto, but would probably work. The other way was to load a list from the file log.txt then write a new entry at the end, and then write it back to the txt file. Is there a way just to write a line of text at the end of a .txt file without all this list stuff? |
|
Back to top |
|
|
nick Contributor
Joined: 15 Aug 2000 Posts: 50 Location: hamburg,nj
|
Posted: Sat Mar 09, 2002 1:50 pm Post subject: |
|
|
Hello:
Try binfile command. _________________ nick |
|
Back to top |
|
|
flypaper Contributor
Joined: 19 Oct 2001 Posts: 104
|
Posted: Sat Mar 09, 2002 3:37 pm Post subject: |
|
|
I had thought of that too, however I'm not sure how to make it only write at the end of the file. |
|
Back to top |
|
|
nick Contributor
Joined: 15 Aug 2000 Posts: 50 Location: hamburg,nj
|
Posted: Sat Mar 09, 2002 3:51 pm Post subject: |
|
|
Hello:
I have used this in one of my programs and I think I use a @cr() after I write each entry. There is a @binfile function that returns the total bytes and another command to move the pointer to that position sa that you can always find the end of file. The reason I am being vague is that I am responding to you from my laptop and I don't have vds on this machine. If you can wait I will probably be able to give you a better answer later in the day.
Good Luck,
Nick _________________ nick |
|
Back to top |
|
|
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Sat Mar 09, 2002 4:04 pm Post subject: |
|
|
Hi,
There are a couple of ways to do this. First keep in mind that there is a bug in VDS that causes a memory leak when writting lists to file over about 20K, so if your log is likely to get big using list savefile is a bad idea. Binfile should do it, you can also do it with vdsinout.dll by writting directly to file or appending on text file to another.
If you need to use list savfefile and can manage the list size you can save lists to separate filles an use the following DOS command to append them:
copy file1.log + file2.log + file3.log master.log |
|
Back to top |
|
|
flypaper Contributor
Joined: 19 Oct 2001 Posts: 104
|
Posted: Sat Mar 09, 2002 5:51 pm Post subject: |
|
|
Nick, I'd love anything more specific you can come up with. I tried the @CR(), but it gave this little rectangle in the .txt file, like it was an unrecognized character. Thanks again guys. I really appreciate it. |
|
Back to top |
|
|
nick Contributor
Joined: 15 Aug 2000 Posts: 50 Location: hamburg,nj
|
Posted: Sat Mar 09, 2002 6:32 pm Post subject: |
|
|
Hello:
Try this:
BINFILE open,4,mystuff.txt,read|write
BINFILE SEEK,4,@BINFILE(SIZE,4)
%A = some more data
BINFILE WRITE,4,TEXT,%A@chr(13)@chr(10)
BINFILE CLOSE,4
Let me know if this solves your problem
Nick _________________ nick |
|
Back to top |
|
|
flypaper Contributor
Joined: 19 Oct 2001 Posts: 104
|
Posted: Sun Mar 10, 2002 2:15 pm Post subject: |
|
|
That worked perfectly. Thanks. |
|
Back to top |
|
|
|