Date: Mon, 13 Sep 1999 12:58:02 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Thone 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: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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.