Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!xanth!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Creating Resources??????? Message-ID: <6573@hoptoad.uucp> Date: 19 Feb 89 10:26:49 GMT References: <4481@hubcap.UUCP> <6569@hoptoad.uucp> <4487@hubcap.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 30 In article <4481@hubcap.UUCP> mikeoro@hubcap.UUCP (Michael K O'Rourke) writes: >I am trying to create and read from a resource to store user preferences. >I created a data structure with two booleans and two inits. All the data >writes out fine, but when I try to read it back in it gets messed up. In article <6569@hoptoad.uucp>, tim@hoptoad.uucp (Tim Maroney) writes: > Sounds like you're using File Manager I/O when you should be using > Resource Manager I/O. Use CreateResFile to make the file to store the In article <4487@hubcap.UUCP> mikeoro@hubcap.UUCP (Michael K O'Rourke) writes: >Nope, I'm using the resource manager. I am using creatresfile and addresource >just like you said, but it doesn't work. As I said, it writes everything out >peachy keen. However, on reading in back it things get mucho fouled up. Oh darn. Well then, to answer your initial question, no you don't need to put a header and so forth on your resource. There are really any number of things that could create this problem; most of them could be eliminated by calling WriteResource directly after you call AddResource. What seems most likely is that you're forgetting that the resource handle becomes sacred after you pass it to AddResource. That is, the system handles it from that point. If you call DisposeHandle or otherwise overwrite it or mess with it in any way other than with Resource Manager calls after that, you're asking for trouble. Best to add it and then have your software ignore the fact that it still exists; let the system take care of it. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "The time is gone, the song is over. Thought I'd something more to say." - Roger Waters, Time