Not sure but try kbhit() returns true if something is waiting. if(kbhit()) { c=getch(); ... }