delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/17/11:01:57

Sender: tim AT riker DOT skynet DOT be
Message-ID: <3ADC5A6A.C9F50B46@falconsoft.be>
Date: Tue, 17 Apr 2001 16:59:54 +0200
From: Tim Van Holder <tim DOT vanholder AT falconsoft DOT be>
Organization: Falcon Software NV
X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.16-3 i686)
X-Accept-Language: en, nl-BE, nl
MIME-Version: 1.0
To: Michael Ahumibe <M DOT Ahumibe AT btinternet DOT com>
CC: djgpp AT delorie DOT com
Subject: Re: fflush (in djgpp)
References: <9aqfuu$fnb$1 AT uranium DOT btinternet DOT com>
Reply-To: djgpp AT delorie DOT com

Michael Ahumibe wrote:
> 
> Can someone tell me what's wrong? or if there is a work around.

As said before fflush(stdin) isn't supposed to clear the input; I
believe
that's a Borlandism (or a Microsoftism, or both).

But IIRC you can use the '%*c' specifier to read any number of
characters
(effectively clearing the input), without placing them into memory.

So scanf ("%d%*c", &age) should read '20' into age and discard the rest.

-- 
Tim Van Holder - Falcon Software N.V.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
This message was posted using plain text. I do not endorse any
products or services that may be hyperlinked to this message.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019