Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!think.com!yale!quasi-eli!cs.yale.edu!cs.yale.edu!bitting-douglas From: bitting-douglas@cs.yale.edu (Douglas Bitting) Newsgroups: comp.sys.mac.programmer Subject: Re: Bug with THINK C 4.0 scanf()? Message-ID: <1991May3.060142.20669@cs.yale.edu> Date: 3 May 91 06:01:42 GMT References: <1991Apr30.081412.8116@beaver.cs.washington.edu> <1991May1.123600.3571@waikato.ac.nz> Sender: news@cs.yale.edu (Usenet News) Distribution: na Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158 Lines: 41 Originator: bitting@suned.CS.Yale.Edu Nntp-Posting-Host: zoo-gw.cs.yale.edu In article <1991May1.123600.3571@waikato.ac.nz> johnc@waikato.ac.nz writes: >In article <1991Apr30.081412.8116@beaver.cs.washington.edu>, chou@cs.washington.edu (Pai Chou) writes: >> I am having a problem with THINK C's scanf for doubles. >> For example, if I scan in a double like 0.0258, I get back 0.258 >> -- it seems that the leading zeros are ignored. >> >> Is anybody else having the same problem? Does anyone >> know a fix? I am using version 4.0. Is it fixed in >> the upgrade? Thanks >> >> Pai Chou >> chou@june.cs.washington.edu > >I'm having exactly the same problem and was searching this newsgroup for the >answer! > >The only way I can get sensible numbers is to put them into sci form >e.g. 0.001 gets read as 0.1 unless you make it 1E-3 which I don't want to >have to do. > >Altering the field specifier in the format string doesn't help at all >e.g. "%8lf" for reading a double in a field of 8 > >(I'm using THINK C v4.0 too) > >Somebody must know! There is a rather nasty bug in the scanf code for THINK C v4.0. This has been fixed as far as I know under THINK C 4.0.2 and later. The updater for 4.0.2 is on sumex somewhere I think. Hopefully, this will take care of your problems. >John Curtis >johnc@waikato.ac.nz Doug -- Doug Bitting | "And we know that in all things God works PO Box 3043 Yale Station | for the good of those who love him..." New Haven, CT 06520 | --Romans 8:28 bitting@cs.yale.edu +------------------------------------------