Get textual part of binary data
| binGetString | Get textual part of binary data |
| License | New BSD License |
| Introduction | I tried to make a function to read textual portion of binary files. |
| binGetString | Get ASCII printable characters portion of the binary data. |
New BSD License
Copyright © 2006, 2007, 2009, 2010, Tuncay All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Tuncay BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
2010-09-29
2.0
String Manipulation, FileSystem
Library
Yes
Yes
binGetString( ByRef _data, _size = "", _offset = 0, _file = "" )
Get ASCII printable characters portion of the binary data.
| data | Reference to variable with the binary data. |
| size | If no file is to load, then this is the final size of string to get. Otherwise it is the size of file to load. Leave blank value “” to get all. |
| offset | How many data (characters) to leave out from begin of data. Defaults to “0”. |
| file | Path to a file to load and overwrite to data variable. |
All characters in string (or file) within range lower than 127 and higher than 31 (compared as decimal ascii values).
Without a filepath at file parameter, ErrorLevel is unchanged. But if a filepath is specified, then ErrorLevel reflects same ErrorLevel as the AutoHotkey builtin command FileRead. “0” for success, otherwise non zero.
MsgBox % str := binGetString(bindata, 800, 64, filename)
Get ASCII printable characters portion of the binary data.
binGetString( ByRef _data, _size = "", _offset = 0, _file = "" )