Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cmcl2!vx2!spector From: spector@vx2.GBA.NYU.EDU (David HM Spector) Newsgroups: comp.sys.mac.programmer Subject: Re: Mac file IO Message-ID: <481@vx2.GBA.NYU.EDU> Date: 6 Jun 89 07:03:16 GMT References: <16464@paris.ics.uci.edu> Reply-To: spector@vx2.UUCP (Alexis Rosen) Organization: Stern School of Business, New York University Lines: 32 In article <16464@paris.ics.uci.edu> poleary@BONNIE.ICS.UCI.EDU (Peter O'Leary) writes: >An application that I am working on needs to save information on a file so >that that file may be opened later. What is the minimum amount of information >that is needed in order to get at a file? So far, I have been storing the >file's name and volume reference number. I call SetVol and everything >seems to work fine until I save this info, exit the program and restart. >The SetVol call then fails with a "Volume not found". I know that under >HFS, there is a directory reference number floating around out there that I >may need to use, but I haven't had any success at playing around with these >either. The vRefNum you are getting is actually a WDRefNum (working directory). As such it will go stale every time you quit your app. You can store a fully qualified pathname instead. This will work until someone changes the folder organization. That's not too bad- if you can't find the folder ask the user where he put it (most programs do this- Think products, like LSP, for example). You can also get the folder number. I haven't looked at this in ages, but I think you want either PBHGetVol or PBGetCatInfo (on the other hand, those names don't look exactly right. Regardless, it shouldn't be too hard to fish out of Inside Mac). Once System 7 comes out life will be much easier, but I doubt you want to wait that long. --- Alexis Rosen temporarily at spector@vx2.gba.nyu.edu alexis@rascal.ics.utexas.edu (last resort)