[Chicago-talk] Parsing a Hex file
arodland at comcast.net
Fri Jan 19 05:13:21 PST 2007
On Thursday 18 January 2007 11:47 pm, Jay Strauss wrote:
> I have these datafiles from my loan origination software. I want to
> monkey with them.
> The vendor lays the file out like:
> byte1, byte2 = field number
> byte3 = field length
> bytes 4 - 256+4 = data value
> Additionally byte1 and byte2 are not read together, instead to get the
> proper value you must read them like: byte2byte1
> Can anyone suggest a easy way to parse this file. Do I really need to
> walk the entire byte stream, manipulating and evaluating, and plucking
> off values?
Perl has a tool just for handling this sort of thing, in the "pack" function.
See perldoc -f pack, perldoc -f unpack, and perldoc perlpacktut, specifically
the bits about the "/" character in pack templates, which allows for
More information about the Chicago-talk