Hi all,
I have a multithreaded program, one of the threads needs to listen for user input. I was wondering is there a way of checking for user input every few seconds or milliseconds, without having the thread hang on a fgets() function?
Current I have:
while(keep_running == TRUE) {
usleep(25);
char command[80];
fgets(command,80,stdin);
/* handle input */
}
I want to change fgets(command,80,stdin); to something that checks for users input and not waits on user input.