Path: utzoo!attcan!uunet!kddlab!trl!rdmei!ptimtc!olivea!samsung!zaphod.mps.ohio-state.edu!ub!acsu.buffalo.edu From: volaski@acsu.buffalo.edu (Maurice Volaski) Newsgroups: comp.sys.mac.programmer Subject: Problem with GetResource in a cdev Message-ID: <48578@eerie.acsu.Buffalo.EDU> Date: 1 Dec 90 07:14:28 GMT Sender: news@acsu.Buffalo.EDU Organization: SUNY Buffalo Lines: 22 In a cdev, I open the resource fork of a file and attempt to read one of its resources. However, GetResource returns a nil handle indicating it is unable to find the resources of the specified type. ResError and MemError both return 0. oldResFile=CurResFile(); /*save reference number to cdev's*/ /*resources*/ *resNum=HOpenResFile(vRefNum,dirID,fileName,fsRdWrPerm); /*open my file's /*resource fork*/ tempRes=GetResource('EXL ',-4048); /* GetResource succeeds here*/ UseResFile(oldResFile); /* make cdev resource file current*/ tempRes=GetResource('EXL ',-4048); /* PROBLEM: GetResource fails*/ num=CountResources('EXL '); /* CountResources succeeds*/ tempRes=GetIndResource('EXL ',1); /*GetIndResouces succeeds*/ Even though the file's resources are not current, GetResource should iterate through the list of open resource files and find the resource. Interestingly, CountResources and GetIndResource both succeed. Also, GetResource does succeed when the file's resources are current. Anyone have a clue as to why GetResource fails in this particular instance? Maurice Volaski