Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!mm5l+ From: mm5l+@andrew.cmu.edu (Matthew Mashyna) Newsgroups: comp.sys.mac.programmer Subject: Re: INIT getting it's file name... Message-ID: Date: 26 Oct 89 13:56:30 GMT References: <56505@tiger.oxy.edu> Distribution: usa Organization: Humanities and Social Sciences, Carnegie Mellon, Pittsburgh, PA Lines: 32 In-Reply-To: <56505@tiger.oxy.edu> Ando Sonenblick: sonenbli@oxy.edu writes: >...is there any way >for an INIT to get the name of the file it is in? I need to later open >the resource fork of the file and I want the user to be able to change the >name of the file; hence, my INIT needs to be able to read in the file name. Check the latest issue of MacTutor: Writing INITs in Think C, by J. Peter Hoddie. findMyName(name) Str255 name; { FCBPRec p; p.ioCompletion = 0; p.ioRefNum = CurResFile(); p.ioVRefNum = 0; p.ioNamePtr = (StringPtr) name; PBGetFCBInfo(&p,false); BlockMove( p.ioNamePtr,&name, 1 + *(char *)(p.ioNamePtr) ); } Matt Mashyna Macintosh Initiative, H&SS Dean's Office Carnegie Mellon