Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!apple!cjp From: cjp@Apple.COM (Chris Plummer) Newsgroups: comp.sys.mac.programmer Subject: Re: ResError Bug? Message-ID: <32877@apple.Apple.COM> Date: 5 Jul 89 21:16:52 GMT References: <5914@hubcap.clemson.edu> <14217@dartvax.Dartmouth.EDU> Organization: Apple Computer Inc, Cupertino, CA Lines: 28 In article <14217@dartvax.Dartmouth.EDU> isle@eleazar.dartmouth.edu (Ken Hancock) writes: >In article <5914@hubcap.clemson.edu> mikeoro@hubcap.clemson.edu (Michael K O'Rourke) writes: >>I am trying to read a PICT resource into my application. I have a if-then >>statment which checks to see if the resource really existed, but it never >>gets called in the error case. >> >>pict := PicHandle(Get1Resource('PICT',pictNumber)); >>if ResError = noErr then >> { do something} >> >>Well, i went in and found out that ResError ALWAYS returns noErr. What's up? > >The correct check is: > >if (pict <> NIL) or for C tyes if (pict != NIL ) > >This, by the way, is in fact documented in inside mac in the >Resource Manager chapter. If a GetResource call cannot find >the resource, it returns a NIL handle but does not generate >a resource mamager error. Not quite. ResError will return noErr if the resource **type** is not found. If the resource type is found but the resource is not then ResError should return resNotFound. The is all documented in IM I-119. By the way, if you use the Inside Mac DA, the writeup for GetResource does not include the note from IM I that talks about ResError returning noErr if the resource type isn't found.