From: Alain Magloire Message-Id: <199905101750.NAA16951@mccoy2.ECE.McGill.CA> Subject: Re: Quirky getch() (fwd) To: djgpp-workers AT delorie DOT com Date: Mon, 10 May 1999 13:50:04 -0400 (EDT) In-Reply-To: from "Eli Zaretskii" at May 10, 99 09:37:25 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Bonjour > Since even stdio functions in the current implementation flush stdout > when stdin is read in line-buffered mode, to prevent the FAQs like the > one above, I thought it would be a prudent thing to make `getch' do > the same. Ok. I was not being negative, but wanted to point the danger of some approach. Let me put it in an other angle. If the next libstdc++v3 do all the buffering internally and does not use the FILE * handle as the underlying implementation What will fflush() in getch() give you ? .. probably more questions. IMHO, it is better, in the long run, to help write better and portable code. But all that said, since getch() is already a non-portable OS specific thing, they are already in trouble water so mine as well give the helping hand. A better approach is to cout.flush() before mixing I/O API and let the internal do the right thing. Without the C++ overhead did you expect this to work : printf ("hello world\n"); printf ("Enter key: "); getch(); The last printf() was not flush, I did not expect it to show. -- au revoir, alain ---- Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!