PerryRaptor Posted April 2, 2006 Posted April 2, 2006 I'm stumped...I'd figured this would help me read/view binary files. At least allow me to load the file to a variable and add, edit and delete. MsgBox() shows nothing...Possibly Hex 05 in the third position is my trouble in the file. ;Use ADO to read binary data... Dim $ReadBinaryFile, $FileName $FileName = InputBox("Read Binary File","Enter Path/Filename for binary read") ReadBinaryFile($FileName) MsgBox(4096,"ReadBinaryFile Function"," " & $ReadBinaryFile) Func ReadBinaryFile($FileName) Const $adTypeBinary = 1 $BinaryStream = ObjCreate("ADODB.Stream"); Create ADODB.Stream object $BinaryStream.Type = $adTypeBinary; Set ADODB.Stream.Type to BINARY $BinaryStream.Open; Open the stream $BinaryStream.LoadFromFile = $FileName; Load the file data from disk to the stream object $ReadBinaryFile = $BinaryStream.Read; Open the stream And get binary data from the object Return $ReadBinaryFile EndFunc
greenmachine Posted April 2, 2006 Posted April 2, 2006 Did you use StringLen() to see if it has a length?
PerryRaptor Posted April 2, 2006 Author Posted April 2, 2006 I've tried FileRead(),FileGetSize(),and StringLen() in an earlier attempt at getting binary data. Windows says the file is 780 bytes; StringLen() reports 2, FileGetSize() reports 0, FileRead() and FileReadline() state the file is not an accessible type. There isn't much in the file...a couple of control codes and a bunch of IP/URL addresses. The file is easily edited with a HexEditor.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now