Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' This can be used to transform binary file to (and from) text file
- Const HexDigits$ = "0123456789ABCDEF"
- Function ToHex$(strin$)
- a% = AscB(c)
- a1% = Int(a / 16): a2% = a Mod 16
- ToHex$ = Mid(HexDigits, a1 + 1, 1) + Mid(HexDigits, a2 + 1, 1)
- End Function
- Sub Bin2Hex(Infile$, Outfile$)
- f% = FreeFile
- Open Infile For Binary Access Read As #f%
- fo% = FreeFile
- Open Outfile For Output Access Write As #fo%
- cnt& = 0
- While Not EOF(f%)
- cnt = cnt + 1
- ch$ = " "
- Get #f%, , ch$
- If Not EOF(f%) Then
- Print #fo%, ToHex(ch);
- End If
- Wend
- Close f%
- Close fo%
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement