home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15182 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  1.7 KB

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!olivea!spool.mu.edu!nigel.msen.com!yale.edu!jvnc.net!darwin.sura.net!haven.umd.edu!ni.umd.edu!zben-mac-ii.umd.edu!user
  2. From: zben@ni.umd.edu (Charles B. Cranston)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Is a resource fork already open?
  5. Message-ID: <zben-080992192800@zben-mac-ii.umd.edu>
  6. Date: 8 Sep 92 23:32:07 GMT
  7. References: <39464@imag.imag.fr> <1992Sep8.153520.10687@waikato.ac.nz> <NEERI.92Sep8130709@iis.ethz.ch> <BuA4CH.9C4@taligent.com>
  8. Sender: usenet@ni.umd.edu (USENET News System)
  9. Followup-To: comp.sys.mac.programmer
  10. Organization: UM Home for the Terminally Analytical
  11. Lines: 23
  12. Nntp-Posting-Host: zben-mac-ii.umd.edu
  13.  
  14. In article <BuA4CH.9C4@taligent.com>, keith@taligent.com (Keith Rollin)
  15. wrote:
  16.  
  17. > Sometimes you want to know if the resource fork is open in _your_
  18. > application. Calling PBGetCatInfo will tell you if the file is open
  19. > within _any_ application. The method Lawrence posted is the proper method.
  20. > (Another method, which is more fun but which is very likely to break at some
  21. > time in the future is to walk the resource chain, pull out refnums, call
  22. > GetFCBInfo on them, and see if the file you are interested in is returned.)
  23.  
  24. Yeah, I missed the ioFlAttib too, since the doc on the field is so far
  25. away from the doc on the trap.  I came up with the follwing:
  26.  
  27. Do GetCatInfo, if ioFRefNum is zero then no access path onto either fork
  28. is open, so the resource fork is not open.
  29.  
  30. Else use a series of indexed GetFCBInfo calls to look for one that
  31. matches ParID and NamePtr and has bit 1 set in ioFCBFlags which says
  32. it is a resource fork path.  I think this is a slightly cleaner version
  33. of what Keith jokingly suggests...
  34.  
  35. zben@ni.umd.edu     -KA3ZDF
  36.