Re: Reading in a file as raw hex bytes?
- From: "Terence" <tbwright@xxxxxxxxx>
- Date: 19 Mar 2007 14:35:22 -0700
The file you are asking about is a non-standard hex dump of a binary
file.
By non-standaard I mean it shows lines of only 10 bytes when a more
normal dump is by 16 bytes per line to match file segments of
multiples of 256 bytes.
So it is formatted in the sense that it has an 8-digit byte counter, a
space, 20 hex digits representing 10 binary values of bytes (0-255)
then the ascii characters themselves from the file in grooups of 10
byes each line.
So all you ahve to do is read the dump file and SKIP OVER THE FIRST 8
counting bytes, plus 1 space plus 20 bytes hex (and the next
unspecified field which has been closed down) and read ONLY THE LAST
10 BYTES for that line.
So you read the whole file as lines of 10 bytes and write out just 10
bytes per line read in (as unformmated binary, writing 1 10-byte
string with no added cr-lf).
The result is the original file that was hex-dumped.
Another way id to read the file with a text editor that allows
removing columns of text (like Worstar does), and simply remove all
the left side for the whole file, leaing the original 10 byes plus cr-
lf of the display.
Then remove all right-hand side cr-lf pairs (another 2-byte hidden
column) and what is left is the original file, which you then save.
.
- References:
- RE: Reading in a file as raw hex bytes?
- From: meek
- RE: Reading in a file as raw hex bytes?
- Prev by Date: Re: iso_c_binding: use of c_int in an initialization expression
- Next by Date: Re: integer factorization subroutine
- Previous by thread: RE: Reading in a file as raw hex bytes?
- Index(es):
Relevant Pages
|