How do i put byte values in an array (structure module)?

G

Guest

hello again...
My problem i gess is this: i can read the bytes from the file, but i don´t
know how to convert it to the array.
See small example and say me something if is possible:

Public Structure CLIENTS
Public codint As Short
<VBFixedString(15)> Public CODCLi As String
<VBFixedString(50)> Public Nome As String
end structure

Private Sub Button1_Click(etc)
Const fileName As String = "clibas.dat"
Dim DATAD As New CLIENTS
Dim fileStream As FileStream = New FileStream(fileName, FileMode.Open)
fileStream.SetLength(68)
fileStream.Seek(0, SeekOrigin.Begin)

For i As Integer = 0 To 68
' HERE IS THE PROBLEM
DATAD = Convert.ToChar(fileStream.ReadByte())
Next i

fileStream.Close()
end sub

can i have some help on passing this bytes to the array?
many thanks
Luis
 
D

Daniel Moth

Use the methods on the BitConverter to go from bytes to other types

Cheers
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top