Question:
What is the C++ equivalent to _getch()
? I need to have program control immediately after any keypress in a DOS-based program.
Answer:
Unfortunately there is no specification in the C++ language or libraries thatimposes any kind of restriction on buffered/unbuffered input/output. This is sobecause there are so many platforms on which C++ is supposed to work and itwould be impossiable for all of them to support such operating system-specificfeatures.
Your best bet in these cases is to use what ever is available in your OS. Inyour case, if _getch()
works, use it.