I want write a program where I call the pause() function to wait for any signal. Now I have registered the SIGIO signal with the following lines of code:
const int on = 1;
fcntl\(STDIN\_FILENO,F_SETOWN,getpid\(\)\);
ioctl\(STDIN_FILENO, FIOASYNC, &on\);
ioctl\(STDIN_FILENO, FIONBIO, &on\);
signal\(SIGIO,catchSIGIO\);
then I called the pause() function. The body of the catchSIGIO() is given below:
void catchSIGIO\(int num\)\{
printf\("INSIDE SIGIO\\n"\);
\}
The program compiles alright. When I run the program, it halts/pauses at the pause() function call. Then when I type something in the keyboard, the SIGIO signal is NOT generated (I guess) because nothing happens. The program remains stuck at the pause() function. I can ONLY get out by pressing ctrl+C.
But I want to detect ANY KEY PRESS by SIGIO signal or any other signal (if there is any).
Can anyone help me on this issue? Thanks in advance.