forcing struct allignment

Leslie Mikesell les at chinet.chi.il.us
Fri Jul 21 04:44:48 AEST 1989


I have a program that current writes a variety of different structs
into a disk file and maintains the seek offsets to access them as needed.
Is there a way to pad them such that the allignment would be correct
if the whole file were read into a malloc()ed block of memory or would
I still have to memcpy() each struct into a correctly alligned memory
block before accessing the members?  When each struct is written to the
disk, the program does not know the type of the struct that will follow.

Les Mikesell



More information about the Comp.lang.c mailing list