Nothing radical here, but handy routines.
Public Sub ReadByteArray(ByVal strPath As String, ByRef arrData() As Byte)
Dim lngFile As Long
' open the file
lngFile = FreeFile
Open strPath For Binary Access Read As lngFile
' allocate enough memory to read file in one go
ReDim arrData(1 To LOF(lngFile)) As Byte
' read blob
Get lngFile, , arrData
' close file
Close lngFile
End Sub
Private Sub WriteByteArray(ByVal strPath As String, ByRef arrData() As Byte)
Dim lngFile As Long
' open the file
lngFile = FreeFile()
Open strPath For Binary Access Write As lngFile
' write blob
Put lngFile, , arrData
' close file
Close lngFile
End Sub
2 comments,
Visual Basic 6, Monday, April 5, 2004 09:01


