Thanks William.
I tried to think how to organize my question. O.K. the file that I need to crack as follows:
I read them in bytes. And only extract the ascii so far. I don't know how to due with the binary byte that has value in hex. Any of your input is very valuable to me. Thank you very much.
***********************
The format of the PDI files we can read look like this:
++----------------------------------+
| <52 byte header containing claim number, etc> |
++----------------------------------+
| <129 byte COMBINED HEADER> +
++----------------------------------+
| <32 byte FILE HEADER (for Status file)> |
++----------------------------------+
| < "Status" FILE (496 Bytes)> |
++----------------------------------+
| <32 byte FILE HEADER (for each additional file)>|
++----------------------------------+
| <FILE (additional files (estimate data, jpegs)> |
++----------------------------------+
In PDI files the "Status" file always appears,
and our software always looks for it.
It's format is documented in the original PDI specification documents.
The format of the incoming 'print image' files currently look like this:
++----------------------------------+
| <52 byte header containing claim number, etc> |
++----------------------------------+
| <'print image' FILE > |
++----------------------------------+
What we need to do to make it work is format the 'print image' the same,
That is we need to make it look like this:
++----------------------------------+
| <52 byte header containing claim number, etc> |
++----------------------------------+
| <129 byte COMBINED HEADER> +
++----------------------------------+
| <32 byte FILE HEADER (for Status file)> |
++----------------------------------+
| <"Status" FILE (496 Bytes)> |
++----------------------------------+
| <32 byte FILE HEADER (for 'print image' file)> |
++----------------------------------+
| <'print image' FILE> |
++----------------------------------+
Here are the field definitions:
The <52 byte header containing claim number, etc> looks like this:
Bytes: 0-2 (STR) "HDR"
Bytes: 3-4 (SHORT) number of image segments (for 'print image', this would be 00)
Bytes: 17-18 (STR) "IM"
Bytes: 19-51 (STR) Claim, Interested Party, and Supp information.
The <COMBINED HEADER> is defined as the next 129 bytes after the initial
header, formatted as follows
absolute byte positions in brackets, Byte counting starts at zero.)
Bytes 0-6(52-58): (STR) "COMB:"
Byte 7(59): (CHAR) 0x05 (hex 05)
Bytes 8-127(60-179):
Byte 128 (180): (CHAR) 0x1A (hex 1A)
The <FILE HEADER> is defined as 32 bytes formatted as follows:
( absolute byte positions in brackets, Byte counting starts at zero.)
Bytes 0-8(181-187): (STR) stored file name
Bytes 9-12(188-191): (STR) stored extension
Bytes:13-14(192-193) (SHORT) file type id
Bytes:15-16(194-195) (SHORT) not used
Bytes:17-20 (196-199)(LONG) uncompressed file size
Bytes:21-24(200-203): (LONG) compressed file size
Bytes:25-26 (204-205)(SHORT) date of file
Bytes:27-28 (205-206)(SHORT) time of file
Bytes:29-31 (207-209)(CHAR) reserved