Duda abriendo archivo en binario para lectura !!

(1/1)

TrashAmbishion:
Código
 
       Dim MyAddress As Integer = &H290968
       Dim a As Object
 
       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
 
 

Esto es un ejemplo que me encontre por la Internet, quisiera saber donde pongo la cantidad de bytes que quiero leer, gracias

Porque me pone 1702129257 y no son los datos que necesito en el editor Hexadecimal me da otros datos...

Gracias de antemano

Eleкtro:
A mi me lee corréctamente los bytes

Aquí puedes especificar la cantidad de bytes a leer:

Citar

Código:

a = br.ReadInt32()


Código
a = br.ReadBytes(2)
MsgBox(BitConverter.ToInt32(a, 0))

Saludos

Navegación

[0] Índice de Mensajes