This should never work but it does. Why?
From: TVR Fan (TVRFan_at_discussions.microsoft.com)
Date: 12/21/04
- Next message: Cor Ligthert: "Re: Threads and stuff"
- Previous message: Raffaele: "Big Problem"
- Next in thread: Brian Cryer: "Re: This should never work but it does. Why?"
- Reply: Brian Cryer: "Re: This should never work but it does. Why?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 21 Dec 2004 06:59:02 -0800
I've just fixed what should be a bug in a simple function to log a message to
a file. The thing is, the original code worked!
Protected Sub LogMessage(ByVal filename As String, ByVal message As
String)
Dim fileNum As Integer
fileNum = FreeFile()
FileSystem.FileOpen(FreeFile(), filename, OpenMode.Append)
FileSystem.PrintLine(fileNum, DateTime.Now.ToString + " - " + message)
FileSystem.FileClose(fileNum)
End Sub
I'm opening the file with one number and then using a different file number
to write the data! Surely the PrintLine and the FileClose should fail. But
the application works and logs mesages to the log file with no problems.
Can anyone explain?
--- Al.
- Next message: Cor Ligthert: "Re: Threads and stuff"
- Previous message: Raffaele: "Big Problem"
- Next in thread: Brian Cryer: "Re: This should never work but it does. Why?"
- Reply: Brian Cryer: "Re: This should never work but it does. Why?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|