I know that you can specify the byte order (Little or Big Endian) when you read one integer at a time with ReadInt(). But how do you specify the byte order in a struct? Here's an abbreviated version of what I'm trying to do...struct datablockhead {
long nblocks;
short status;
};
void ReadHeader(string strFile)
{
datablockhead vnmrh;
file ff;
ff.Open(strFile, file::modeRead);
ff.Read(&vnmrh, sizeof(vnmrh));
ff.Close();
printf("# blocks: %d", vnmrh.nblocks); // wrong byte order
printf("status: %d", vnmrh.status); // wrong byte order
}
BTW, I'm just starting out with structs so please let me know if I'm doing anything stupid.
...Forgot to declare ff above, but that was just a transcription error.
Mike Buess
Origin WebRing Member
Edited by - Mike Buess on 02/26/2003 3:18:34 PM