Have you been looking for something like this ??? this program will not be stopped, since you press Ctrl + A and Enter.
#include <stdio.h> int main() { char a; while( a!=1 ) //Ascii code for ctrl + A == 1 { a=getchar(); printf("still looping ...\n"); } printf( "HA! You pressed CTRL+A\n" ); return 0; }
But if you want to terminate your program immediately after pressing ctrl + A (without getting into it after that), you are here:
#include <stdio.h>
to compile the second code using GCC, try the following command:
gcc -o program.o -lncurses program.cpp
source share