Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!hydroplane.cis.ohio-state.edu!spencer From: spencer@hydroplane.cis.ohio-state.edu (Stephen N. Spencer) Newsgroups: comp.sys.mac.programmer Subject: Re: String to Float conversion woes... Message-ID: <74495@tut.cis.ohio-state.edu> Date: 29 Nov 89 13:04:49 GMT References: <74424@tut.cis.ohio-state.edu> <839@gistdev.gist.com> Sender: news@tut.cis.ohio-state.edu Reply-To: Stephen N. Spencer Distribution: usa Organization: The Advanced Computing Center for the Arts and Design Lines: 33 In article <839@gistdev.gist.com> joe@gistdev.UUCP (Joe Brownlee) writes: >In article <74424@tut.cis.ohio-state.edu> Stephen N. Spencer writes: >>(Using THINK C 3.02 on a 1Meg Mac Plus...) >>[...] And, interestingly enough, I must be >>using "PtoCstr()" incorrectly -- set it up just like my calls to "CtoPstr()" >>and the compiler complained of my call not matching the prototype. > >You know, I had lots of troubles with trying to use "PtoCstr()" in LSC 3.02, >too. I #include'd what the manual said, and it always gave me a link error. >I never did solve it, but then, I didn't have to since I am now using a string >library like ANSI C that works on Pascal-style strings. I tried adding lots >of the canned libraries to my project, but no luck. > >Anyone else seen these problems? > Thanks to several people on the 'Net, esp. "mm35+@andrew.cmu.edu", I've solved my problems with converting Str255 to floats. Basically, what I did was: GetDItem(dialog, ID, &iType, &iHndle, &iBox); GetIText(iHndle, &iStr); iStr[iStr[0]+1] = '\0'; f = (float)atof((char *)&iStr[1]); Again, thanks. -=- Stephen N. Spencer |"For a successful technology, reality must take ACCAD, 1224 Kinnear Rd. | precedence over public relations, for Nature Columbus OH 43212 | cannot be fooled." - Richard P. Feynman spencer@heinlein.cgrg.ohio-state.edu OR spencer@cis.ohio-state.edu