Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!apple!motcsd!dms!rotberg From: rotberg@dms.UUCP (Ed Rotberg) Newsgroups: comp.sys.mac.programmer Subject: Re: Reading Numbers from Modal Dialog Items...PLEASE HELP Message-ID: <1149@dms.UUCP> Date: 10 Sep 90 15:57:51 GMT References: <29331@netnews.upenn.edu> Organization: Atari Games Inc., Milpitas, CA Lines: 24 From article <29331@netnews.upenn.edu>, by isler@grad1.cis.upenn.edu (Sylvia-Kay ISLER): > I am writing a program in Think C 3.0 that has to obtain floating point values > from modal dialog items. I am running into serious problems. > I am trying to do so using this code: > > getparameter(num, value) > int num; > float *value; lines deleted... > sscanf(PtoCstr((char *)text), "%3.3f", *&value); ^^ I beleive that I have some code at home that gets floating point data from a dialog, but in the meantime, I think this contruct looks suspect. Since value is a pointer to a float, just pass value to sscanf. Also, I might suggest just using %f instead of %3.3f unless you have a real reason to limit the field. The field width specifiers are primarily for output, especially when one is expecting only one value in the entire input string ... you are expecting only one value, aren't you? If this doesn't help, I'll try to dig up that other code... - Ed Rotberg -