home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- 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
- From: zben@ni.umd.edu (Charles B. Cranston)
- Subject: Re: Simple Question: Getting the vRefNum and DirectoryID
- Message-ID: <zben-120892173516@zben-mac-ii.umd.edu>
- Followup-To: comp.sys.mac.programmer
- Sender: usenet@ni.umd.edu (USENET News System)
- Nntp-Posting-Host: zben-mac-ii.umd.edu
- Organization: UM Home for the Terminally Analytical
- References: <1992Aug11.185456.10885@nntp.uoregon.edu>
- Distribution: usa
- Date: Wed, 12 Aug 1992 21:42:01 GMT
- Lines: 29
-
- In article <1992Aug11.185456.10885@nntp.uoregon.edu>,
- eric_gorr@coglab_psych.uoregon.edu (Eric Gorr) wrote:
-
- > Let's say that I have a valid path stored in a varable defined as:
- > char *thePath;
- > The String in the path would look something like: "P300:mydir" with
- > P300 being the volume and mydir (obviously) being the directory.
- > What I need is the volume reference number and the id for this directory.
-
- This is a little more complicated than it first seems, since the
- GetCatInfo call is not documented to return the vRefNum. Best
- scheme I can think of is:
-
- 1. Temporarily save the length byte of the path string.
- 2. Scan the path string searching for the first colon.
- 3. Stuff the index into the length byte so just the volume
- name and colon are in the string. For the example P300:mydir
- above we would have saved 10 in step 1, we now set the length
- byte to 5 so the string says P300: only.
- 4. Do a GetVolInfo on the string (ioVolIndex zero) and obtain the
- desired vRefNum from ioVRefNum.
- 5. Restore the saved length byte from step 1.
- 6. Do a GetCatInfo on the string (ioVRefNum, ioDirID, ioFDirIndex zero)
- and obtain the DirectoryID from ioDirID.
-
- What do we do if a colon is not found in step 2? Do a GetVol and
- use the result (current default volume) as vRefNum?
-
- zben@ni.umd.edu -KA3ZDF
-