Write hex in little endian

  • Thread starter Thread starter extream87
  • Start date Start date
E

extream87

Guest
Hello i need to write hex to an file.

Im using this to read in big endian/little endian

Dim beBOM As New System.Text.UnicodeEncoding(True, True)
Dim littleEndian As Long
Dim bigEndian As Long
Using fs As New IO.FileStream("C:\Temp\theFile.bin", IO.FileMode.Open),
br As New IO.BinaryReader(fs, beBOM)
fs.Position = &H12
Dim startIdx As Integer = 0
Dim b() As Byte = br.ReadBytes(4)
littleEndian = BitConverter.ToInt32(b, startIdx)
bigEndian = BitConverter.ToInt32(b.Reverse.ToArray, startIdx)
End Using

Numericupdown1.value = littleEndian.ToString
MessageBox.Show(bigEndian.ToString())

In this case littleEndian is showed in Numericupdown1

My target is change the value and write again to file but this time in hex.

Thanks

Continue reading...
 
Back
Top