Dim MyAddress as Short = &H132
' assumes that you are using the OpenFileDialog to get the path & Filename
Dim filename As String = OpenFileDialog1.FileName
Dim fs As FileStream = New FileStream(filename, FileMode.Open)
Dim br As BinaryReader = New BinaryReader(fs)
Dim sz As Integer = fs.Length' you don't neccessarily need this, I use this in my app. toset the size an Array.
br.BaseStream.Seek(MyAddress, SeekOrigin.Begin)'moves to the address you want
a = br.ReadInt32() 'reads Both Bytes (characters you want)
ListBox1.Items.Add("My Address Data: " + (a).ToString()) 'Adds the data to a listbox
br.Close()'close the Binary Reader
fs.Close()' close the FileStream
To overwrite the character(s) just do the reverse and use the Binary Writer. (make sure you don't write more than the number of
characters (Bytes) you need to or you will overwrite (corrupt) data you don't intend to.
james
"Dave" <no****@yahoo.com> wrote in message news:en**************@TK2MSFTNGP10.phx.gbl...
Greetings,
How do I read the hex value of a binary file at a given offset? i.e., how can I find out, via code, what the 2-digit hex code
is at, say, offset 132ea. Then, how would I write over that value?
Thanks,
-Dave