Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!att!cbnewsk!ech From: ech@cbnewsk.ATT.COM (ned.horvath) Newsgroups: comp.sys.mac.programmer Subject: Re: Please help w/ PBSetCatInfo Message-ID: <1774@cbnewsk.ATT.COM> Date: 8 Jan 90 21:50:26 GMT References: <30340@shemp.CS.UCLA.EDU> Distribution: usa Organization: AT&T Bell Laboratories Lines: 34 From article <30340@shemp.CS.UCLA.EDU>, by tj@oahu.cs.ucla.edu (Tom Johnson): ! Can somebody please help??? ! The following is a small piece of code in Think C 4.0. ! Why can't I get it to work? ! ! #define SFSaveDisk 0x214 /*low memory global*/ ! myCInfoPBRec myInfoRec; ! Str255 directoryName; ! ! ! myInfoRec.dirInfo.ioNamePtr = directoryName; ! myInfoRec.dirInfo.ioDrDirID=MyCurDir; /* from SFGetFile as in DTS SC 018 */ ! myInfoRec.dirInfo.ioFDirIndex = -1; /*directories only*/ ! myInfoRec.dirInfo.ioVRefNum =(-*(short *)SFSaveDisk); ! error=PBGetCatInfo(&myInfoRec,false); ! if (error != noErr) SysBeep(10); ! /*I was making a few changes here, but even when they were ! removed, the problem didn't go away*/ ! error=PBSetCatInfo(&myInfoRec,false); ! if (error != noErr) Debugger(); ! ! When I run this code, no error is detected on the PBSetCatInfo call and ! the CInfoPBRec appears to be correctly filled in, but PBSetCatInfo ! returns error=FFD5 a fnfError (file not found). Does anybody have ! any idea why? This has been driving me crazy for hours!! I assume you meant "no error is detected on the PBGetCatInfo." The problem is that the ioDrDirID field is interpreted by PBSetCatInfo as the dirID of the PARENT directory, whereas PBGetCatInfo accepted and set the dirID of MyCurDir. Thus, between the calls, set ioDrDirID from ioDrParID. And don't feel bad, that is far from clear in IM IV. =Ned Horvath=