PDA

Click to See Complete Forum and Search --> : binary File


haroldweir
Jul 23rd, 2001, 05:41 AM
Does anyone know how to load a binary file, to an array.

Nucleus
Jul 23rd, 2001, 08:30 AM
Don't know exactly what you want, but this code may help as it shows how to read all data from any file into a byte array:


Private Sub Command1_Click()
'Read all data into byte array using get statement

Dim ba() As Byte, ff&, i&, a

ff = FreeFile
Open "c:\tmp\test.txt" For Binary As #ff
ReDim ba(0 To LOF(ff) - 1)
Get #ff, , ba
Close #ff

For i = 0 To UBound(ba)
Debug.Print ba(i)
Next
End Sub