Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!sdd.hp.com!mips!smsc.sony.com!dce From: dce@smsc.sony.com (David Elliott) Newsgroups: comp.sys.mac.programmer Subject: Question: Putting structs in resources Message-ID: <1990Sep5.145717.13291@smsc.sony.com> Date: 5 Sep 90 14:57:17 GMT Sender: dce@smsc.sony.com (David Elliott) Organization: Sony Microsystems Corp, San Jose, CA Lines: 28 As a Unix programmer, I've learned that it is usually a bad idea to write the contents of a struct to a file, since there is no way to know if every machine can read it back correctly. As you may already know, data written on a big-endian machine, such as a 680x0, will have a different format than on a little-endian machine, such as a Vax or a DEC MIPS-based machine. In addition, machines may have different alignment rules. For example, a Sun 3 (68020) allows a long (32 bit integer) to be aligned on half-word (16-bit) boundaries, whereas the SPARC-based machines require full-word alignment. As a result, a struct written on a Sun 3 may have to be handled specially when read back on a Sun 4 (a typical method is to define the struct as containing shorts and then convert the shorts to longs by copying). Is it common practice to read and write structs as resources on the Mac? If so, is there any worry that these resources will not be compatible if Apple were to go to a platform with different alignment restrictions (I assume byte order isn't an issue)? If not, what is the recommended procedure for putting lots of data into a resource and getting it back easily? -- ...David Elliott ...dce@smsc.sony.com | ...!{uunet,mips}!sonyusa!dce ...(408)944-4073 ...Krusty says: Give a hoot, read a book!