The replacement for getch() is getchar() declared in stdio.h . getchar() is available on Windows and Linux.
The following is a comment by Max Trucks .
There are some (somewhat important) differences between getch() and getchar() .
1) getch() returns immediately after pressing a key. getchar() allows you to enter indefinitely, until you enter EOL.
2) getch() does not display anything. getchar() records everything that you type on the screen (even EOL).
If these two differences are not important to the user, you can use getchar() as a replacement, otherwise this might not be the best idea.
Nathan Mar 26 '14 at 20:16 2014-03-26 20:16
source share