I\'m trying to make a game that continues running until a key is pressed and then it should take that key in and do something with it then continue running as per normal. Ho
Sounds like you want to wait for a key to be pressed and then continue execution:
//test.c
#include
#include
void *input_listener(void *threadarg)
{
getchar();
printf("A key was pressed.\n");
}
int main()
{
printf("Start\n");
pthread_t thread;
pthread_create(&thread, NULL, input_listener, NULL);
pthread_join(thread, NULL);
// Continue main
}
Should be very simple to do with pthreads (need to compile: gcc test.c -lpthread).