Byte arrays

Can someone give me a code sample of how to read a binary file's contents into a byte array and vice-versa?
thanks
LVL 2
tylerdAsked:
Who is Participating?
 
autConnect With a Mentor Commented:
Try this code. It should do it
Private Sub Command1_Click()
    Dim FileName As String
    Dim FileNumber As Integer
    Dim Buffer() As Byte
   
    'Set the path for the file hear
    FileName = "C:\windows\desktop\test.txt"
   
    FileNumber = FreeFile
    Open FileName For Binary Access Read As FileNumber
    ReDim Buffer(LOF(FileNumber) - 1)
    Get #1, , Buffer()
    Close FileNumber
End Sub
0
All Courses

From novice to tech pro — start learning today.