Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!munnari!otc!metro!ipso!runx!clubmac From: clubmac@runx.ips.oz (Macintosh Users Group) Newsgroups: comp.sys.mac Subject: Re: obtaining the full pathname of a file Message-ID: <973@runx.ips.oz> Date: Wed, 17-Jun-87 05:58:22 EDT Article-I.D.: runx.973 Posted: Wed Jun 17 05:58:22 1987 Date-Received: Sun, 21-Jun-87 13:58:55 EDT References: <1345@batcomputer.tn.cornell.edu> Reply-To: clubmac@runx.OZ (Macintosh Users Group - Sydney, Australia) Organization: Club Mac Macintosh Users Group - Sydney, Australia Lines: 35 In article <1345@batcomputer.tn.cornell.edu> steig@tcgould.tn.cornell.edu.UUCP (Mark J. Steiglitz) writes: > >I am writing a program in Lightspeed C that asks the user for a filename >using the standard file package and then processes the text in that file >using some of the stdio C routines. I use fopen() to open the file. > >fopen() requires the pathname of the file, but SFGetFile and SFPutFile only >return the filename and the working directory reference number. How do I >obtain the pathname of the file? >-- Mark, I haven't seen any code to compute a full HFS pathname to a file from it's filename and WDRefNum (Does anyone have code?), but if you use GetVol and SetVol, you shouldn't have any problems. I hope this code segment helps. .... GetVol(NULL,&currVol); /* Get default volume now for restoration after fopen() call */ SetVol(NULL,reply.vRefNum); /* Set default volume to volume abtained from SF{Get,Put}File call */ PtoCstr(reply.fName); /* Convert fName for fopen() call */ fp = fopen(reply.fName,"r"); /* open */ CtoPstr(reply.fName); /* balance PtoCstr() */ SetVol(NULL,currVol); /* restore */ .... Jason Haines Club Mac Macintosh Users Group - Sydney, Australia Snail: Box 213, Holme Building, Sydney University, NSW, 2006, Australia ACSnet: clubmac@runx.ips.oz ARPA: clubmac%runx.ips.oz@seismo.css.gov UUCP:{enea,hplabs,mcvax,prlb2,seismo,ubc-vision,ukc}!munnari!runx.ips.oz!clubmac