troubleshooting Question

Input Past End of File in VB6

Avatar of Bob Schneider
Bob SchneiderFlag for United States of America asked on
Visual Basic Classic
2 Comments1 Solution243 ViewsLast Modified:
I am getting an "Input past end of file" with the code below...
            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
NorieAnalyst Assistant
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros