I am trying to read lines from a text file and transmit them to a distant location to reconstruct the file. I have no control over how the files were written. Sometimes the last line has <CR><LF>, sometimes <CR>, sometimes <LF>, and sometimes no termination characters. Line Input doesnt input the <CR><LF>. I have tried using Seek before and after Line Input and comparing that with the length of the input string as shown in the following code.
I know what to do if there are two extra characters or no extra characters but one extra character is ambiguous.
Is there an easier way to solve this than opening the file in binary and reading one character at a time?
Code:
Open gstrTxPCDir & gstrTxPCFileName For Input As #TextUDLFNum
more code
lngPosBeforeRead = Seek(TextUDLFNum)
Line Input #TextUDLFNum, strOneLine
lngPosAfterRead = Seek(TextUDLFNum)
intLen = Len(strOneLine)
MsgBox "lngPosBeforeRead = " & lngPosBeforeRead _
& vbCrLf & "lngPosAfterRead = " & lngPosAfterRead _
& vbCrLf & "intLen = " & intLen _
& vbCrLf & "strOneLine = " & strOneLine
Is there an easier way to solve this than opening the file in binary and reading one character at a time?