home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!uwm.edu!cs.utexas.edu!natinst.com!stepan
- From: stepan@natinst.com (Stepan Riha)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Help w/files needed...
- Message-ID: <1992Aug20.205546.22434@natinst.com>
- Date: 20 Aug 92 20:55:46 GMT
- Article-I.D.: natinst.1992Aug20.205546.22434
- References: <l-hyzaq@rpi.edu> <1992Aug20.153053.26419@cgrg.ohio-state.edu>
- Sender: news@natinst.com
- Distribution: usa
- Organization: National Instruments, Austin, TX
- Lines: 16
- Nntp-Posting-Host: falcon.natinst.com
-
- Description on how to use fopen with SFGetFile (rather neat) ...
- ...
- > SFGetFile(SFGWhere,NIL,NIL,1,MyTypes,NIL,&reply);
- > if (!reply.good) return;
- > SetVol(0L, reply.vRefNum);
- > strcpy(inFileName,reply.fName);
- > PtoCstr(inFileName);
- > inp = fopen(inFileName,"r");
- ...
- I don't believe reply.fName is 0 terminated, so the first strcpy is dangerous.
- Rather, call PtoCStr(reply.fName);
- Then you can safely do the strcpy(inFileName,reply.fName) or simply use
- reply.fName instead of inFileName.
-
- --
- Stepan Riha -- stepan@natinst.com
-