Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!cernvax!marty From: marty@cernvax.cern.ch (hugues marty) Newsgroups: comp.sys.mac.programmer Subject: Re: Numbers from TEXT files under Think C ? Message-ID: <4978@cernvax.cern.ch> Date: 22 Apr 91 08:33:47 GMT References: <17150002@hpihoah.cup.hp.com> Organization: CERN, European Laboratory for Particle Physics Lines: 21 In article <17150002@hpihoah.cup.hp.com> cring@hpihoah.cup.hp.com (Craig Ring) writes: >I am writing a program in Think C 4.0 that needs to read numeric input from >an ASCII text file. Under UNIX this is very easy to do with fscanf() and so >on. Is there a simple way to do this with a Macintosh? > >I would like to be able to use SFGetFile() to allow the user to pick the >file they would like to open, but the SFReply doesn't seem to be very useful >to the ANSI C libraries for Think C. The Think C documentation says that >scanf() requires a pointer to type FILE, which I am not sure how to get. One way is to call SFGetFile(), then geting the whole path name for the selected file (for example "HD:folder 1:document") and passing this string to the fopen() function which will return a FILE *. The problem is how to get the file path... and I don't have a sample code off-hand. If you have access to technical notes, this is documented in TN 238 (Getting a full pathname). Good luck, Hugues. -- e+ ----> :-) <---- e- e-mail : Les Chercheurs de Bosons Unifies marty@cernvax.cern.ch