www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/13/10:31:44

Date: Mon, 13 Sep 1999 12:58:02 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Thone <thone AT nettaxi DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: I wonder why i can't use fflush() in DJGPP
In-Reply-To: <7r8jd1$vri$1@atom.nectec.or.th>
Message-ID: <Pine.SUN.3.91.990913125710.8923A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 9 Sep 1999, Thone wrote:

>            scanf("%c", &ch);
>            scanf("%c", &ch);
>   the computer will wait for user input data for one time.
> so I asked someone about that and he told me to put
> ffluch(stdin) between those two lines.So I do that and it's
> ok when I use Borland C++ compiler.But when i use
> DJGPP it still have the same problem,

`fflush's effect is only defined for output streams.  What Borland
does with "fflush(stdin);" is an unportable extension; you shouldn't
rely on it.

If you want to write code that reads characters one at a time, don't
use buffered input functions, they always read an entire line.  Use
library function `getch' or `getkey' instead.

- Raw text -


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