Date: Thu, 27 Aug 1998 10:21:03 -0300 (EST) From: Carlos Eduardo Dantas de Menezes To: Nate Eldredge cc: dj AT delorie DOT com, djgpp-workers AT delorie DOT com, Vik DOT Heyndrickx AT rug DOT ac DOT be, George Foot Subject: Re: In-Reply-To: <35CA4428.27B48B43@cartsys.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk Dear colleagues, Please excuse me. There was a mistake in that program: #include main() { int a, b, c; char d; scanf("%d%d", &a, &b); scanf("%c", &d); if (d=='y') c=a*b; /* ^ \_ in original was 'c' */ else c=a+b; printf("\n%d\n", c); } Thanks to George Foot by let me see this! The (reformulated) problem is: what could be the best way to clean the buffer (Nate Eldredge told me that "ANSI says that the effect of fflush'ing an input stream is undefined") to the second scanf call doesn't read next character typed just after the second number, if it is newline? Excuse me my mistakes and thank you in advance! Carlos Menezes -- Tycho Brahe Project LABORATORIO DE SISTEMAS INTEGRAVEIS. ESCOLA POLITECNICA DA UNIVERSIDADE DE SAO PAULO. E-MAIL: menezes AT lsi DOT usp DOT br URL: http://www.lsi.usp.br/~menezes/menezes.html