What I want to know is if I have a defined structured object with known parameters and a known order. I want to parse a binary blob into this structure in a generic way.
For example, I know that my file is a binary file of this structure
typedef struct {
uint frCompressedSize;
uint frUncompressedSize;
ushort frFileNameLength;
ushort frExtraFieldLength;
char frFileName[ frFileNameLength ];
uchar frExtraField[ frExtraFieldLength ];
uchar frData[ frCompressedSize ];
} ZIPFILERECORD;
Is there a better way to do this than reading in individual fields at a time in a hard coded manner? In my real code the structure has almost 100 parameters so the hardcoded method is not my first choice.
Any Ideas?
thanks!