Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!bcm!dimacs.rutgers.edu!seismo!ukma!uflorida!uakari.primate.wisc.edu!dali.cs.montana.edu!rpi!julius.cs.uiuc.edu!apple!bc From: bc@Apple.COM (bill coderre) Newsgroups: comp.sys.mac.programmer Subject: Re: SFPutFile with fopen(...) in c? How? Message-ID: <46643@apple.Apple.COM> Date: 16 Nov 90 16:58:11 GMT References: <1990Nov1.205312.13778@midway.uchicago.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 32 Here is a fragment of Think C that allows Think's lib and Mac's Standard File dialogs to be intermixed: /* Open the input file. */ MyTypes[0] = 'TEXT'; 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"); if (inp == NULL) { strcpy(&sTemp,"Can't seem to open input file: "); strcat(&sTemp,inFileName); ParamText(CtoPstr(sTemp),"\p","\p","\p"); A_Lose(); return; }; Since emacs and apple.com's dialins are fighting the XON/XOFF game, please excuse any spurious garbage. The function A_Lose puts up an "uh-oh" alert and effectively aborts the program. Primitive but functional errorchecking. I got this idea and almost all the code itself by calling Think C's tech support people. Thanks guys. good luck bc private consultant, not apple spokesdroid