www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/05/09/07:00:56

From: Kbwms AT aol DOT com
Message-ID: <486df3f3.2466c4b3@aol.com>
Date: Sun, 9 May 1999 07:00:03 EDT
Subject: Re: Quirky getch() (fwd)
To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
CC: djgpp-workers AT delorie DOT com
MIME-Version: 1.0
X-Mailer: AOL 3.0 16-bit for Windows sub 38
Reply-To: djgpp-workers AT delorie DOT com

Dear Eli Zaretskii,

On 05-09-99 at 05:30:02 EST you wrote:
>
>
> Given the forwarded message, should we add fflush(stdout+stderr) to
> `getch', like we already did in `filbuf'?  Or would programs that use
> `getch' hate us for flushing the streams for every input character?
>

Heaven forbid!

As nearly as I can determine, the performance of the output utility
is the intended one.

> #include <conio.h>
> #include <iostream.h>
>
> int main() {
>   clrscr();
>   cout << "Hello World\n";
>   cout << "Sing along!";
>   getch();
>   return 0;
> }

The second line wasn't flushed by the output utility because it wasn't
a complete line.  If user wants a line printed before a call to getch(),
said user should issue a `fflush()' beforehand.  The thought that every
call to getch() would be preceded by automatic calls to fflush(stdout)
and fflush(stderr) is chilling indeed.


K.B. Williams

- Raw text -


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