home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20451 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.5 KB  |  49 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!ames!data.nas.nasa.gov!taligent!kip-28.taligent.com!user
  3. From: keith@taligent.com (Keith Rollin)
  4. Subject: Re: HELP! INIT and patching probs
  5. Message-ID: <keith-301292142544@kip-28.taligent.com>
  6. Followup-To: comp.sys.mac.programmer
  7. Sender: usenet@taligent.com (More Bytes Than You Can Read)
  8. Organization: Taligent
  9. References: <C03AHq.9LF@news.cso.uiuc.edu>
  10. Date: Wed, 30 Dec 1992 22:33:54 GMT
  11. Lines: 36
  12.  
  13. In article <C03AHq.9LF@news.cso.uiuc.edu>, cole@alexia.lis.uiuc.edu (Sandra
  14. Stewart-Cole) wrote:
  15. > Is there any DOCUMENTED and SUPPORTED way to
  16. > get enough info about a file solely from the fact that it is the current 
  17. > Resource file that I can then regain a path to it after I have been cut loose 
  18. > from it  WITHOUT relying on System 7 features? (i.e. get the info in the INIT,
  19. > and store it for later use from a global trap patch)
  20. >
  21.  
  22. Execute this at INIT time:
  23.  
  24.     FSSpec me;
  25.     OSErr err;
  26.     FCBPBRec        pb;
  27.  
  28.     pb.ioCompletion = nil;
  29.     pb.ioNamePtr = me.name;
  30.     pb.ioVRefNum = 0;
  31.     pb.ioRefNum = CurResFile();
  32.     pb.ioFCBIndx = 0;
  33.  
  34.     err = PBGetFCBInfoSync(&pb);
  35.  
  36.     me.vRefNum = pb.ioFCBVRefNum;
  37.     me.parID = pb.ioFCBParID;
  38.  
  39. I usually use THINK C, which makes the storage of the results in a global
  40. variable really simple. If you use MPW, then you can use the techniques
  41. shown in Technote #256 (OK, fine, so it has a new name, now) or "develop
  42. #12" to implement global variables. Or use a little assembly.
  43.  
  44. -----
  45. Keith Rollin
  46. Phantom Programmer
  47. Taligent, Inc.
  48.