I am trying to read a text file, filled with ASCII characters. I am able to read about 1/5 of the file before my code stops, which I assume is because its reaching the end of file. I am using the inputstring function to read my data file. Should I use a different reading method or what would be best recommended for me?
I would use the streamreader, which does read the entire file, however it is unable to handle all of the ASCII characters correctly for example, a "ÿ" in the file is read by the streamreader as "�", thus changing the value I need.
Here is part of my code along with the data file I am trying to read.
Any help would be greatly appreciated. Thanks
I would use the streamreader, which does read the entire file, however it is unable to handle all of the ASCII characters correctly for example, a "ÿ" in the file is read by the streamreader as "�", thus changing the value I need.
Here is part of my code along with the data file I am trying to read.
VB.NET:
While Not EOF(1)
oneChar = Strings.Asc(InputString(1, 1))
If n = 1 Then
F = (oneChar And 15)
F2 = (oneChar)
Else
F = (oneChar)
F2 = (oneChar And 15)
n = 0
End If
If n = 1 Then
lastCharF1 = F
TotalF2 = (F2) + (lastCharF2 * 256)
If TotalF2 > 2048 Then
TotalfrF2 = TotalF2 - 4096
Else
TotalfrF2 = TotalF2
End If
F2Box = F2Box & TotalF2 & Chr(13) + Chr(10)
F2FRBox = F2FRBox & TotalfrF2 & Chr(13) + Chr(10)
Else
TotalF1 = (lastCharF1 * 256) + (F)
If TotalF1 > 2048 Then
TotalfrF1 = TotalF1 - 4096
Else
TotalfrF1 = TotalF1
End If
F1Box = F1Box & TotalF1 & Chr(13) + Chr(10)
F1FRBox = F1FRBox & TotalfrF1 & Chr(13) + Chr(10)
lastCharF2 = F2
End If
n = n + 1
End While
Any help would be greatly appreciated. Thanks