Well, I'm programming using C language on a Linux OS. I'm writing a program that scans an input from the user. However, I want the scanf to have a certain time limit. For example, if the user does not enter anything on the keyboard withing 10 seconds, it will skip the scanf and go to the next line. I'm using alarm(10) to wait for 10 seconds, but when I go to the alarmhandler I don't know what to do to skip the scanf.
Is there a function to skip scanf or for example write \n to the input buffer?