Posted By

sukantahazra on 02/15/10


Tagged

unix linux signal


Versions (?)

Simple Linux signal handler


 / Published in: C
 

  1. #include <stdio.h>
  2. #include <signal.h>
  3. #include <stdlib.h>
  4.  
  5. void sig_handler(int signum)
  6. {
  7. printf("Received signal %d\n", signum);
  8. }
  9.  
  10. int main()
  11. {
  12. signal(SIGINT, sig_handler);
  13. for(;;);
  14. return 0;
  15. }

Report this snippet  

You need to login to post a comment.