Path: utzoo!attcan!uunet!decwrl!adobe!hawley From: hawley@adobe.COM (Steve Hawley) Newsgroups: comp.sys.mac.programmer Subject: Re: Question: Putting structs in resources Message-ID: <6294@adobe.UUCP> Date: 5 Sep 90 21:02:01 GMT References: <1990Sep5.145717.13291@smsc.sony.com> Reply-To: hawley@adobe.UUCP (Steve Hawley) Organization: Adobe Systems Incorporated, Mountain View Lines: 39 In article <1990Sep5.145717.13291@smsc.sony.com> dce@smsc.sony.com (David Elliott) writes: >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? OK - as far as reading/writing structures is concerned, you should have no problem doing this on the Macintosh platform, since they have done remarkably well in maintaining compatability. Famous last words, but I say go ahead because a change in the operating/file system that causes a change in byte ordering will break a HUGE number of applications --more than such a change could possibly help. The biggest danger to you is your compiler/interpretter changing the way it allocates structures. If you're really terrified, remmeber that you can always break the structure down to the byte level (since bytes are bytes, right?) piecemeal from the elements and put the resulting bytes into a buffer, then ship it out to disk. This is of course, tedious and slow (but surely not slower than the bottleneck of your bulk storage). As far as "putting lots of data into a resource", please do not stumble into the habit of using the resource fork of a file as a pigpen for data. The reason being that 1) any custom data format will be managed much more efficiently by you 2) if you try to write an application that writes into its own resource fork, you will have endless problems working with a fileserver. Remember, the data fork of a file is for data. Steve Hawley hawley@adobe.com -- "I can always telephone, but I can't tell it much." -Roy Blount