P
PeteCresswell
Got a routing that works, sort of.
I do a FreeFile, followed by Open For Append As... to get a pointer,
then I keep passing the same pointer to my little routine whenever I
want to write
another line to the text file.
Problem is that the lines I write are not appearing in the file
until sometime after I write them.
This becomes a problem if things go South after I've written but
before the file has been updated.
Is there some way to force a write when I do my Print
statement?
Or do I need to keep opening/closing the file every time I write?
Code:
------------------------------------------------------------------
Private Sub logFile_Write(ByVal theLine As String, ByVal
theFilePointer As Integer)
4000 DebugStackPush mModuleName & ":logFile_Write"
4001 On Error GoTo logFile_Write_err
' PURPOSE: To write a single line to the cash import log file.
' ACCEPTS: - Line tb written
' - Pointer to already-opened file
4002 Dim myLine As String
4010 myLine = Format$(Now(), "hh:nn:ss") & " " & theLine
4999 Print #theFilePointer, myLine
logFile_Write_xit:
DebugStackPop
On Error Resume Next
Exit Sub
logFile_Write_err:
BugAlert True, ""
Resume logFile_Write_xit
End Sub
------------------------------------------------------------------
I do a FreeFile, followed by Open For Append As... to get a pointer,
then I keep passing the same pointer to my little routine whenever I
want to write
another line to the text file.
Problem is that the lines I write are not appearing in the file
until sometime after I write them.
This becomes a problem if things go South after I've written but
before the file has been updated.
Is there some way to force a write when I do my Print
statement?
Or do I need to keep opening/closing the file every time I write?
Code:
------------------------------------------------------------------
Private Sub logFile_Write(ByVal theLine As String, ByVal
theFilePointer As Integer)
4000 DebugStackPush mModuleName & ":logFile_Write"
4001 On Error GoTo logFile_Write_err
' PURPOSE: To write a single line to the cash import log file.
' ACCEPTS: - Line tb written
' - Pointer to already-opened file
4002 Dim myLine As String
4010 myLine = Format$(Now(), "hh:nn:ss") & " " & theLine
4999 Print #theFilePointer, myLine
logFile_Write_xit:
DebugStackPop
On Error Resume Next
Exit Sub
logFile_Write_err:
BugAlert True, ""
Resume logFile_Write_xit
End Sub
------------------------------------------------------------------