I have a BinaryReader that I am parsing data with. There are two elements included in the data that are 6 bytes of ASCII (null-terminated).
Within the code I have:
This works for as long as the data is empty (zeros) and the BinaryReader's underlying stream position is advancing as it should. Once I hit an iteration with real data, the ReadChars will sometimes advance the stream 7 or 10 bytes instead of 6. Then the remaining iterations are off.
Does anyone know why this is happening? Is the null-terminator causing a problem? Why would the stream advance past the point I asked for?
Thanks.
Within the code I have:
Code:
For i = 0 to 10
Dim tNum as integer = br.ReadInt32
Dim tConn as byte = br.ReadByte
Dim tLo as string = br.ReadChars(6)
Dim tHi as string = br.ReadChars(6)
Dim tImg as integer = br.ReadInt32
Next
This works for as long as the data is empty (zeros) and the BinaryReader's underlying stream position is advancing as it should. Once I hit an iteration with real data, the ReadChars will sometimes advance the stream 7 or 10 bytes instead of 6. Then the remaining iterations are off.
Does anyone know why this is happening? Is the null-terminator causing a problem? Why would the stream advance past the point I asked for?
Thanks.