Hi there, I've stumbled upon another problem. I need to be able to read bytes in Little Endian and in Big Endian as well. Is this possible to do in VB? I know that VB reads in Little Endian by default, but I also need to read in Big Endian.
I have tried this:
This return the value "1616183296" when it is supposed to return "21856". I've opened the file up in Hex Workshop, and looking at it in Little Endian, I do get the value of "1616183296" and in Big Endian, I get the value of "21856". So Obviously I'm not doing it right.Code:Dim i1 as Long Dim fs As New IO.FileStream(filename, IO.FileMode.Open) Dim br As New IO.BinaryReader(fs, System.Text.Encoding.BigEndianUnicode) Dim lBytes As Long = fs.Length fs.Position = 0 i1 = br.ReadInt32() fs.close br.close fs.dispose Msgbox(i1)
Can anyone help with this? Thanks!




Reply With Quote