Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!caen!sdd.hp.com!think.com!huxley!steve From: steve@huxley.huxley.bitstream.com (Steve Stein) Newsgroups: comp.sys.mac.programmer Subject: Re: Bug with THINK C 4.0 scanf()? Message-ID: Date: 1 May 91 13:32:42 GMT References: <1991Apr30.081412.8116@beaver.cs.washington.edu> <1991May1.123600.3571@waikato.ac.nz> Sender: steve@huxley.UUCP Reply-To: (Stephen Z. Stein) Distribution: na Organization: Bitstream, Inc. Lines: 35 In-reply-to: johnc@waikato.ac.nz's message of 1 May 91 00:36:00 GMT My scanf works OK. I have upgraded to THINK C 4.0.4 (though if you're not running System 7, I think 4.0.2 is what you should be running). In looking at the scanf.c source, about 60% through the file I see: /* (floating) process each digit */ case -2: if (c>='0' && c<='9') { F.valid = TRUE; if (c!='0' || D.sig[0]) { if (D.sig[0] < sizeof D.sig - 1) D.sig[++D.sig[0]]=c; } if (F.dot) /* moved this from inside the previous block - THINK tech sup */ --D.exp; } Note the "if (F.dot)" moved from inside previous block. This, I presume, was the bug you are seeing. I suggest you find an upgrade to 4.0.2. Call Symantec languages tech support. They are friendly, helpful, and knowledgable. They probably won't give you irresponsible advice like the following: Alternatively, and I don't suggest this unless you know what you are doing, you can hack the scanf source yourself in the ANSI project, remake the project, and reload it into your applications. If you have to ask how exactly this is done, then please don't do it. (PLEASE if you do this, do it on a copy and save the original distribution ANSI and scanf.c.) - Steve Stein