Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!ukc!edcastle!cs.ed.ac.uk!cs.edinburgh.ac.uk!nick From: nick@cs.edinburgh.ac.uk (Nick Rothwell) Newsgroups: comp.sys.mac.programmer Subject: Re: THINK C Help with Resources Keywords: AddResource Message-ID: <522@skye.cs.ed.ac.uk> Date: 5 Oct 90 10:51:31 GMT References: < <30543@netnews.upenn.edu> Sender: nnews@cs.ed.ac.uk Reply-To: nick@lfcs.ed.ac.uk Organization: Wavetables 'R' Us Lines: 25 In article <30543@netnews.upenn.edu>, gilbert@grad1.cis.upenn.edu (Michael Gilbert) writes: > I want to store this thing as a resource in a file. So, I first call > CreateResFile (myFileName); (with appropriate error-checks), and > then UseResFile (myFileName) to make use of the file. Finally, I use > > AddResource ((Handle) myThingHandle ...) > > to add the resource. Now, using ResEdit, I can see that the > resource was indeed added correctly to this file. However, after > saving this data to the file and closing it, the data in my object is > corrupted. I don't have my copy of Inside Mac to hand, and I haven't actually written applications which create resources, so this is a rough guess, but it's possible the handle is getting purged and/or moved as soon as you flush it to the file. In all my Mac programming, I always wrap calls to H{Un}Lock and H{No}Purge around anything I'm not certain about. Just an idea... Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh. nick@lfcs.ed.ac.uk !mcsun!ukc!lfcs!nick ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ "Now remember - and this is most important - you must think in Russian."