Mail Archives: djgpp/1997/01/21/15:18:32
> i don't no if NE1 else has noticed this but there is a very annoying
> featire with getch() and getche(). as a newbie i'd much appreciate NE1
> who could point out how to fix it.
>
> Here's the problem.
>
> --code segment--
> cout << "Y for yes or N for No: ";
> answer = getche();
> ......
> --end--
This has to do with buffering of the I/O. I don't know how to fix it
using standard streams for C++, but for C I/O, use
fflush (stdout)
after the prompt "Y for yes or N for No: " is printed.
Alternately, you can use the console (conio.h) I/O functions.
Hope this helps.
David May, ID Card Administrator
Albuquerque TVI
- Raw text -