Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!mimsy!oasys!oasys.dt.navy.mil!science From: science@oasys.dt.navy.mil (Zimmermann) Newsgroups: comp.sys.mac.hypercard Subject: FSOpen() XFCN query Message-ID: <8474@oasys.dt.navy.mil> Date: 16 Jun 91 20:19:15 GMT Sender: news@oasys.dt.navy.mil Organization: David Taylor Research Center, Bethesda, Md. Lines: 34 Help! I need to open a named file from within a HyperCard XFCN (written by me in Think C, running under System 7.0 in HyperCard 2.1), WITHOUT going through a Standard Files Dialog ... can somebody show me an example of a Think C code fragment to do so? Maybe this is trivial (I hope so!), but I can't get it to work without calling SFGetFile() first to get a vRefNum and file name (unless the named file is in the same directory as HyperCard itself -- see below). What am I doing wrong? Specifically, I seem to be having trouble with getting the vRefNum to work right ... I had thought (naively?) that I could use 0 for a vRefNum and provide a file name, and the file would be opened if it was in the same directory as the current HC stack (which I assumed would be the default volume) ... that clearly doesn't work. I tried calling GetVol() with NULL for volName, and that gives me back a vRefNum which seems to correspond to the directory in which HyperCard itself lives (which makes sense, since HC is running the stack which my XFCN is executing from). So, I can open my named file with FSOpen() when it is in the same directory as HyperCard, not a good solution. My attempts to provide a colon-delimited path as part of the fileName given to FSOpen() also have failed. So, any advice? My ultimate goal is to simply find out the vRefNum for the directory in which my stack is stored, and to open a named file in that very directory. Would it work to ask HyperCard to provide me with "the long name of this stack" and then to edit that into shape? But what about the vRefNum that I need to provide FSOpen()?? Tnx for any advice or pointers to relevant info or sample code! ... ^z (Mark Zimmermann, "science@oasys.dt.navy.mil", "zimmermann" on AppleLink) P.S. I am still looking for examples/advice re interapplication communication between HC2.1 stacks and UNIX-like Think C programs ... has anybody actually *done* this yet? tnx -- ^z^z