www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/27/03:45:50

Message-Id: <A967083001E72A00@iris.ernet.in>
Date: 27 Nov 96 10:53 IST
From: tehmul%NIITPUN AT iris DOT ernet DOT in
Sender: tehmul%niitpun AT iris DOT ernet DOT in
To: djgpp AT delorie DOT com
Subject: Re: flushing buffers
Mime-Version: 1.0

                              
J. Lee wrote:
> ...
> My problem is as follows.
> ...
> Before i get an input from the keyboard using any of the stdio functions
> (ex. scanf, getchar(),gets etc.), i always flush out the buffer using
> fflush(stdin). However, the buffer is never flushed out.  On my next
> getchar() statement, for example, the remaining characters in the buffer
> are retrieved instead of waiting for new input.  The fflush(stdin) work
> fine when i am using UNIX.  How can i solve this very frustrating
> problem in DJGPP?

I had the same problem.  ANSI doesn't define fflush on input streams which is 
why the fflush didn't work.  Use rewind( stdin ) instead of fflush( stdin ).  
That ought to cure your woes.

Ciao.
TG

- Raw text -


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