License: New BSD License
Download (~11 kb)
The archive contains the library, a demo script and the documentation. Also all required modules are included.Online Documentation
Description
I tried to make a function to read textual portion of binary files. After searching the forum, I did not find any solution (that day). The function can be used to read out headers etc.
Examples
MsgBox % str := binGetString(bindata, 800, 64, filename)
#Include binGetString.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
; Any positiv number is the size of first bytes to load.
sizeToRead := 5000
; Specify how many characters to leave before
; beginning to work with file.
seek := 0
; Select source file
FileSelectFile, filepath, %A_WorkingDir%,, Select binary file
If (ErrorLevel = 0)
{
; Read file into memory
FileRead, bindata, %filepath%
; Strip non printable ASCII characters from file
str := binGetString(bindata, sizeToRead, seek, filepath)
; Show that content now
MsgBox,, %filepath%, %str%
}Edit: Name changed from binfile to binGetString. In general, it is the same function. In addition, it does leave out the first 31 ascii characters too.




