Bob Schneider
asked on
Input Past End of File in VB6
I am getting an "Input past end of file" with the code below...
And it is including rows in the file that end in "FS", which I am trying to avoid. Here is what I get when I run this:
BS
BS
BS
BS
BS
BS
FS
FS
FS
BS
BS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
Any help would be much appreciated!
Set fsoIn = New Scripting.FileSystemObject
Set fsoOut = New Scripting.FileSystemObject
Set tsTxtFileIn = fsoIn.OpenTextFile(sPath & "rfid\putty.log", ForReading, False, TristateMixed)
If fsoOut.FileExists(sPath & "rfid\" & iBox & ".txt") Then
Set tsTxtFileOut = fsoOut.OpenTextFile(sPath & "rfid\" & iBox & ".txt", ForWriting, False, TristateMixed)
Else
Set tsTxtFileOut = fsoOut.CreateTextFile(sPath & "rfid\" & iBox & ".txt")
End If
With tsTxtFileIn
Do Until .AtEndOfStream
If Left$(.ReadLine, 2) = "aa" Then
If Right$(.ReadLine, 2) <> "FS" Then
Debug.Print Right$(.ReadLine, 2)
strIn = .ReadLine
strHex1 = CInt("&H" & Mid$(strIn, 33, 4))
strHex2 = CLng("&H" & Mid$(strIn, 9, 8))
If Not Left$(strHex2, 1) = "-" Then
strOut = Mid$(strIn, 4, 1) & "," & strHex2 & ",0," & _
QUOTE & Mid$(strIn, 27, 2) & ":" & Mid$(strIn, 29, 2) & ":" & Mid$(strIn, 31, 2) & _
"." & strHex1 & QUOTE & "," & Mid$(strIn, 4, 1) & ",0"
tsTxtFileOut.WriteLine strOut
End If
End If
End If
Loop
.Close
End With
End If
And it is including rows in the file that end in "FS", which I am trying to avoid. Here is what I get when I run this:
BS
BS
BS
BS
BS
BS
FS
FS
FS
BS
BS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
LS
Any help would be much appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER