home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 13900 < prev    next >
Encoding:
Text File  |  1992-08-12  |  1.9 KB  |  44 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!icd.ab.com!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!haven.umd.edu!ni.umd.edu!zben-mac-ii.umd.edu!user
  3. From: zben@ni.umd.edu (Charles B. Cranston)
  4. Subject: Re: Simple Question:  Getting the vRefNum and DirectoryID
  5. Message-ID: <zben-120892173516@zben-mac-ii.umd.edu>
  6. Followup-To: comp.sys.mac.programmer
  7. Sender: usenet@ni.umd.edu (USENET News System)
  8. Nntp-Posting-Host: zben-mac-ii.umd.edu
  9. Organization: UM Home for the Terminally Analytical
  10. References: <1992Aug11.185456.10885@nntp.uoregon.edu>
  11. Distribution: usa
  12. Date: Wed, 12 Aug 1992 21:42:01 GMT
  13. Lines: 29
  14.  
  15. In article <1992Aug11.185456.10885@nntp.uoregon.edu>,
  16. eric_gorr@coglab_psych.uoregon.edu (Eric Gorr) wrote:
  17.  
  18. > Let's say that I have a valid path stored in a varable defined as:
  19. > char    *thePath;
  20. > The String in the path would look something like:  "P300:mydir"  with
  21. > P300 being the volume and mydir (obviously) being the directory.
  22. > What I need is the volume reference number and the id for this directory.
  23.  
  24. This is a little more complicated than it first seems, since the
  25. GetCatInfo call is not documented to return the vRefNum.  Best
  26. scheme I can think of is:
  27.  
  28. 1. Temporarily save the length byte of the path string.
  29. 2. Scan the path string searching for the first colon.
  30. 3. Stuff the index into the length byte so just the volume
  31.    name and colon are in the string.  For the example P300:mydir
  32.    above we would have saved 10 in step 1, we now set the length
  33.    byte to 5 so the string says P300: only.
  34. 4. Do a GetVolInfo on the string (ioVolIndex zero) and obtain the
  35.    desired vRefNum from ioVRefNum.
  36. 5. Restore the saved length byte from step 1.
  37. 6. Do a GetCatInfo on the string (ioVRefNum, ioDirID, ioFDirIndex zero)
  38.    and obtain the DirectoryID from ioDirID.
  39.  
  40. What do we do if a colon is not found in step 2?  Do a GetVol and
  41. use the result (current default volume) as vRefNum?
  42.  
  43. zben@ni.umd.edu     -KA3ZDF
  44.