请参阅下面的代码。希望它会有所帮助。
#include <stdio.h> int main() { char ch; do{ ch = getch(); printf("Inputed char: %c\n", ch); }while(ch != 27); }