Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bloom-beacon!bu-cs!dartvax!eleazar.dartmouth.edu!isle From: isle@eleazar.dartmouth.edu (Ken Hancock) Newsgroups: comp.sys.mac.programmer Subject: Re: ResError Bug? Message-ID: <14217@dartvax.Dartmouth.EDU> Date: 5 Jul 89 18:56:53 GMT References: <5914@hubcap.clemson.edu> Sender: news@dartvax.Dartmouth.EDU Reply-To: isle@eleazar.dartmouth.edu (Ken Hancock) Organization: Personal Computing Center, Dartmouth College Lines: 26 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. Ken Ken Hancock '90 | BITNET/UUCP/ Personal Computing Ctr Consultant | INTERNET: isle@eleazar.dartmouth.edu -----------------------------------+---------------------------------------- DISCLAIMER? I don't get paid enough to worry about disclaimers.