Mail Archives: djgpp-workers/1999/05/10/13:50:27
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 !!!
- Raw text -