I have written a C console program meant to check the key pressed at any time the program is running. However I have to press ENTER each time to process the input from the keyboard. How to get the key pressed each time without having to press the ENTER key ? Here is what I have so far:
# include <stdio.h>
#include <stdlib.h>
#define RUNNING 1
int main()
{ printf("---------------------------------------------------------
-------------\n\n");
puts("Welcome to PUSH COUNTER appliction :)");
puts("Type any key to test here ...");
printf("---------------------------------------------------------
-------------\n\n");
while (RUNNING){
char c = getchar();
if(c != ' ') {
printf("Not a space button... Program listening for push button .\n\n");
}
else {
printf("Finally pressed a space bar. Updating counter now ...\n");
}
}
return(0);
}