Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: THINK C and SFGetFile w/FSOpen Message-ID: <42918@apple.Apple.COM> Date: 12 Jul 90 20:25:26 GMT References: <6533.269b32ac@umiami.miami.edu> Organization: Apple Computer Inc, Cupertino, CA Lines: 33 In article <6533.269b32ac@umiami.miami.edu> chuck@umiami.miami.edu writes: >Hello folx. > >I'm working with THINK C 4.0.2. I'm trying to do a simple SFGetFile and >FSOpen procedure to open up a file so I can do some processing. For some >reason, it seems that the SFGetFile is getting a bad address, and I get a >system bomb when FSOpen is called. Any ideas? Check out my code below. >By the way, the SFGetFile dialog box comes up, and myWindow shows up, too. >Everything points to a problem with either where reply points to, or a problem >with the way I'm handling FSOpen. > >where.v=100; >where.h=100; >SFGetFile(where," ",0L,0,'',0L,&reply); I think there are at least 3 problems with this call: 1) for a prompt string, you are passing a pointer to a C string with one character in it; a space. You should really be passing a Pascal string: "\p". 2) you are passing 0 for numTypes. This is an invalid value. If you don't want to specify any types, pass a -1. This is documented in Inside Mac. 3) you are passing '' where you should be passing a pointer to a typeList. In C, I think it should be OK to specify *(SFTypeList *)0L if you don't have a typelist that will be used. -- ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. --- Developer Technical Support INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions