I am using a binary reader along with the stream reader to read a data file. After I read the header lines with the stream reader I then start using the binary reader. The issue I am having is what should be the first 107 characters (different depending of the data file) that should be read is skipped, and then the binaryreader starts and runs just fine. I attached a portion of my code that starts right before I call the binary reader (br) the stream reader (sr) is reading until the end of a header that ends with the |^Data Set^| and carrage returns. so with this the binary reader does not start where the stream reader ended... rather it skippes a bunch of characters. I am attaching the datafile that I am working with.
CODE
StringCheck = Convert.ToChar(sr.Read)
While l <= 10
StringCheck = StringCheck + Convert.ToChar(sr.Read)
l = l + 1
End While
While i = 1
StringCheck = StringCheck & Convert.ToChar(sr.Read)
If Microsoft.VisualBasic.Right(StringCheck, 12) = "|^Data Set^|" Then
i = 2
StringCheck = StringCheck & Convert.ToChar(sr.Read) & Convert.ToChar(sr.Read)
End If
End While
x = x & StringCheck & Chr(13) + Chr(10) & Chr(13) + Chr(10) & Chr(13) + Chr(10)
i = 1
Iterations = (Stepx * Stepy * NumPts) - 200
While i < Iterations
oneChar = (br.ReadByte())
lastCharF1 = oneChar
oneChar = (br.ReadByte())
F = (oneChar And 15)
TotalF1 = (lastCharF1) + (F * 256)
x = x & lastCharF1 & " , " & Chr(lastCharF1) & " , " & F & " , " & Chr(F) & " , " & i & Chr(13) + Chr(10)
i = i + 1
End While