Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!ncar!midway!arthur!francis From: francis@arthur.uchicago.edu (Francis Stracke) Newsgroups: comp.sys.mac.programmer Subject: Re: Can't seem to get SFGetFile to work....! Message-ID: <1990Sep26.215556.16391@midway.uchicago.edu> Date: 26 Sep 90 21:55:56 GMT References: <9183@potomac.ads.com> Sender: news@midway.uchicago.edu (News Administrator) Organization: Mathematics Department, University of Chicago Lines: 30 In article <9183@potomac.ads.com> jtn@potomac.ads.com (John T. Nelson) writes: > [...]>Here's the problem. The very >first thing I do in a program is call a function I call "selectFile" >which is basically a shell wrapped around SFGetFile.... [...] >Well the call to selectFile causes a Bus Error right on the SFGetFile >and I can't figure out why. I've checked with other Macintosh books >("Using the Macintosh ToolBox with C", "Macintosh Revealed" and even >"Inside Macintosh") and the call looks kosher. Problem is that even >the above three references vary on what they say should go into >SFGetFile. [...] >selectFile looks like this.... [...] >selectFile(char *name) >{ > int numTypes; > OSType tList; /* Was SFTypeList */ [...] > numTypes = -1; [...] > tList = '????'; > > SFGetFile(position, "\p", 0L, numTypes, &tList, 0L, &reply); I'm assuming that passing a ptr to an OSType would be OK if SFGetFile thought that it was an SFTypeList with 1 elt; but for that you probably need numTypes=1! (Oh, God, it's thinking you've got 65535 file types!) (I'm assuming because I'm a Pascal programmer myself, & all I've got is IM, which, as we all know, completely ignores C.)