J
Jim Luedke
What's the test for whether a file is currently open (or closed)?
My app writes to a log file, but I don't want to burden the caller
with opening the file in the event he never has to write to it. So I
want:
Dim H As Long
Sub Log(Msg as String)
If Not IsOpen(H) then
Open LogFile For Output As #H
Print #H, FileHeader & DateTime
Print #H,
End If
Print #H, Msg
End Sub
Sub Main
Repeat
If Not Something Then
Log "Oops"
End If
Until SomethingElse
Close #H
End Sub
So what expression should "IsOpen(H)" be?
Thanks.
***
My app writes to a log file, but I don't want to burden the caller
with opening the file in the event he never has to write to it. So I
want:
Dim H As Long
Sub Log(Msg as String)
If Not IsOpen(H) then
Open LogFile For Output As #H
Print #H, FileHeader & DateTime
Print #H,
End If
Print #H, Msg
End Sub
Sub Main
Repeat
If Not Something Then
Log "Oops"
End If
Until SomethingElse
Close #H
End Sub
So what expression should "IsOpen(H)" be?
Thanks.
***