Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!maverick.ksu.ksu.edu!hoss!fergvax!231b3679 From: 231b3679@fergvax.unl.edu (CS 231 section 2) Newsgroups: comp.sys.mac.programmer Subject: Think C 4.0.2 scanf problem (was Re: MPW C 3.1 scanf problem) Message-ID: <231b3679.665440606@fergvax> Date: 1 Feb 91 20:36:46 GMT References: <867.27A8F9CD@stjhmc.fidonet.org> Sender: news@hoss.unl.edu (Network News Administer) Organization: University of Nebraska - Lincoln Lines: 23 Here's a simple (illogical) program: #include main() { int i, j; printf ("Enter your age: "); scanf("%d", &i); printf ("Enter your weight: "); scanf("%d", &j); printf ("\n\nQ = %d.\n", i*j); /* don't worry about Q=ij... */ } On the VAX, this program works as expected, But when I try something like this using Think C, the first scanf() works right, but say I entered 21 and hit return, Think C skips over the next scanf() as if I had just hit a blank return! To get around that, I have had to use some el-Majoro kludges, like using gets() and atoi(). I'm using version 4.0.2, and I'm pretty sure that when I used the updater I updated the scanf() with the patch (but maybe not... I've reinstalled Think C so many times in the last year I could've forgotten to apply the scanf() patch). Perhaps Phil Shapiro or Rich Siegel could enlighten me? --mike gleason