forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Is there an easier way to write a log file than this?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Sat Mar 09, 2002 1:08 pm    Post subject: Is there an easier way to write a log file than this? Reply with quote

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
View user's profile Send private message
nick
Contributor
Contributor


Joined: 15 Aug 2000
Posts: 50
Location: hamburg,nj

PostPosted: Sat Mar 09, 2002 1:50 pm    Post subject: Reply with quote

Hello:
Try binfile command.

_________________
nick
Back to top
View user's profile Send private message
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Sat Mar 09, 2002 3:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
nick
Contributor
Contributor


Joined: 15 Aug 2000
Posts: 50
Location: hamburg,nj

PostPosted: Sat Mar 09, 2002 3:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
moke
Contributor
Contributor


Joined: 02 Jan 2002
Posts: 162

PostPosted: Sat Mar 09, 2002 4:04 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Sat Mar 09, 2002 5:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
nick
Contributor
Contributor


Joined: 15 Aug 2000
Posts: 50
Location: hamburg,nj

PostPosted: Sat Mar 09, 2002 6:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Sun Mar 10, 2002 2:15 pm    Post subject: Reply with quote

That worked perfectly. Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group