Valhalla Legends Forums Archive | General Programming | VB/ Using the Print #1 Statement

AuthorMessageTime
Crypticflare
Allright I've been fiddling around with stuff and I'd like to know what I've been doing wrong with this line of code

[code]Open (App.Path & "\TextLog" & Time & ".txt") For Output As #1 [/code]

I'd like it to output a textlog, and with the name of the text file it has the Time, and Date created (though I didn't add date) is this not possible or would I have to do somthing else?
March 7, 2003, 9:30 AM
Spht
A filename cannot contain any of the following characters:
\ / : * ? " < > |
March 7, 2003, 10:56 AM
Spht
Or if that wasn't your problem, for printing data to that file, use:

Print #1, DATA

DATA being what you want to write to the file.

If you want to add text to the file as it gets in, use Append instead of Output when accessing the file. Then Print will add the DATA on a following line in the file.
March 7, 2003, 11:01 AM
MesiaH
also, that #1 is just a little number you use to keep track of which file is open, so if you call another subroutine and do a Print #1, then youll be printing to that file, if it hasnt been closed.
March 9, 2003, 11:27 PM

Search