-
Hi guys,
I have a logging function that will log anything i choose to the logfile, i have a bit of a problem with it..
all it does is use PRINT #File to output to the file..
the logfile will print to a certain point (halfway through a line) then stop, until i close my program.. it goes thru the print statement, i checked.. it just wont do it immediately... anyone know a solution.. code is below for my log function btw..
Code:
Public Function do_log(message As String)
If Not NOLOG Then Print #LogFile, Format(Date, "mm/dd/yyyy") & " " & Format(Time(), "hh:nn:ss") & " " & message
End Function
Ok, update, It now doesnt output _anything_ until i close the form.. (it did before, just missed about 3 lines) any ideas?
[Edited by CAPHS on 10-14-2000 at 07:03 AM]
-
Did you use the open and close #LogFile? this will close the file, it writes immediatly in my case!
Close #filenumber > will only close the specified filenumber
Close > will close all the open files.
-
i didnt use close yet, no, because i open LogFile at the very start of my prog, and it remains open throughout.. so i can simply call the function anytime(this isnt a big problem, i just noticed it and want to fix it if i can) i figure it must be that i dont close it between each right eh?
-
it may depend on the method you have used to open the file in the first place. If you use the Locked / Read Write keywords, or you have done a combination of these, then you may not be able to open the file (in notepad for example) until you have used the close statement.
-
Printer.EndDoc will cause printing to start immediately.
-
hehe Marty, we're talking about 'printing' to a file.. you know :)
CAPHS, yeah, when you don't use close, you don't notice any updates in the file I think, until you do close #fn.
Hope you got it to work now (damn I drink to much!)
-
-
Ever considered using a database as a log? U definitely have other parameters to upkeep?
-
It seems like your buffering's getting confused. VB has told Windows to write the data, but it hasn't sent enough, so the buffer needs to be flushed...not that I know how...