Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!ncar!mailrus!cornell!uw-beaver!rice!sun-spots-request From: mcvax!moncam!paul@uunet.uu.net (Paul Hudson) Newsgroups: comp.sys.sun Subject: Re:Can I force a Sun 4 *NOT* to align elements on 16 bit boundaries Message-ID: <8812051026.AA18945@marvin.moncam.uucp> Date: 15 Dec 88 08:04:11 GMT Sender: usenet@rice.edu Organization: Rice University, Houston, Texas Lines: 16 Approved: Sun-Spots@rice.edu Original-Date: Mon, 5 Dec 88 10:26:16 GMT X-Sun-Spots-Digest: Volume 7, Issue 55, message 9 of 14 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@moncam.co.uk Milton Road, Cambridge, CB4 4FQ