Little problem with sizeof on PC

Mark Allender allender at cso.uiuc.edu
Wed Apr 24 01:50:42 AEST 1991


I have a structure that is defined like:

struct header {
	int version[2];
	char unused[40];
	int stuff[8];
	char bogus;
	char mode;
	int time;
	char unused2[90];
	char filler[38];
	char filler2[15]
	float number;
};

Just a followup to me problem with the word alignment in this structure..
The data that I am reading in someone else's form, and has to stay this way.
I can't change it.  And indeed, I would rather have the data in raw binary
form.  There is a filler byte inserted after the filler2[15] declaration.

The best suggestion around this was to read the entire 201 bytes into
a char buffer[201] array, and then memcpy the elements into their corresponding
location.

Thanks to all who responded.....

-- 
-Mark Allender
-University of Illinois at Urbana/Champaign
-Conversation Builder Project
-allender at cs.uiuc.edu



More information about the Comp.lang.c mailing list