As for explicit offsets; I mean, as a way to describe the format of the data in a file.
For exemple (hypothetical) a file with a header:
<type of the file> 4 bytes
<version> 4 bytes
<Language ID> 2 bytes
<offset to name section> 4 bytes
<offset to description section> 4 bytes
then an array of entry structures:
<offset to its name relative to the name section> 4bytes
<offset to its description in the description section> 4 bytes
then the name section and description section.
for the moment I see only two "ways" of parsing the file, supposing it is mapped in memory:
unsigned short lang_id;
unsigned long name_sec;
unsigned long desc_sec;
unsigned long name;
unsigned long desc;
and the code gets rather unpleasant:
#define HEADER_LENGTH 18
#define HE_TYPE 0
#define HE_VERSION 4
#define HE_LANGID 8
#define HE_NAMESEC 10
#define HE_DESCSEC 14
#define ENTRY_LENGTH 8
#define EN_NAME 0
#define EN_DESC 4
with things like:
But wihout the pragma, because of the 2 bytes language ID member in this case, it is the only way out I see... This is all supposing I cannot modify the file format.
*((unsigned long*)(pTemp + EN_DESC ))...