Can I force a Sun 4 *NOT* to align elements on 16 bit boundaries

Paul Hudson mcvax!moncam!paul at uunet.uu.net
Thu Dec 15 18:04:11 AEST 1988


You've just tripped up on one of the oldest no-no's in the C world.
Trying to use structs saved in a file on a variety of machines is almost
bound not to work! With care (and alignment to large boundaries and
ignoring problems of bytes order and ....) it can be done some of the
time.

I think the best way out is to write a routine to to the I/O on your file,
treating it as a byte stream, and fill in or read out of the struct
aligned how the host machine wants it. Now that should port .... ;-)!

Paul Hudson 

Snail mail: Monotype ADG	Email:	...!ukc!acorn!moncam!paul
	    Science Park,		paul at moncam.co.uk
	    Milton Road,
	    Cambridge,
	    CB4 4FQ



More information about the Comp.sys.sun mailing list