Signal Handling in C

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2010-03-20T22:28:55Z Indexed on 2010/03/20 22:31 UTC
Read the original article Hit count: 445

Filed under:
|
|
|

How can I implement signal Handling for Ctrl-C and Ctrl-D in C....So If Ctrl-C is pressed then the program will ignore and try to get the input from the user again...If Ctrl-D is pressed then the program will terminate...

My program follows:

int main(){
 char msg[400];

 while(1){
   printf("Enter: ");
   fgets(msg,400,stdin);
   printf("%s\n",msg); 
 }
}

Thanks,

Dave

© Stack Overflow or respective owner

Related posts about unix

Related posts about signals