Valhalla Legends Archive

Programming => General Programming => Topic started by: Crypticflare on March 07, 2003, 03:30 AM

Title: VB/ Using the Print #1 Statement
Post by: Crypticflare on March 07, 2003, 03:30 AM
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

Open (App.Path & "\TextLog" & Time & ".txt") For Output As #1
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?
Title: Re: VB/ Using the Print #1 Statement
Post by: Spht on March 07, 2003, 04:56 AM
A filename cannot contain any of the following characters:
\ / : * ? " < > |
Title: Re: VB/ Using the Print #1 Statement
Post by: Spht on March 07, 2003, 05:01 AM
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.
Title: Re: VB/ Using the Print #1 Statement
Post by: Mesiah / haiseM on March 09, 2003, 05:27 PM
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.