Created
March 18, 2011 16:02
-
-
Save Vaysman/876329 to your computer and use it in GitHub Desktop.
read binary file on vb 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim iFile As Integer | |
Dim lByteLen As Long | |
Dim bytData As Byte | |
Dim bytArray() As Byte | |
Dim sHex As String | |
'get an available file ID | |
iFile = FreeFile | |
'open the file for access | |
Open "C:\MyFile.ext" For Binary As iFile | |
'get current len of file | |
lByteLen = LOF(iFile) | |
If lByteLen >= 11 Then | |
Get iFile, 11, bytData | |
sHex = Hex(bytData) | |
'write over a byte | |
bytData = Asc("Z") | |
Put iFile, 9, bytData | |
'grab entire file contents | |
Redim bytArray(1 To lByteLen) | |
Get iFile, 1, bytArray | |
End If | |
'must close file when done | |
Close iFile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment