Simple Linux signal handler


/ Published in: C
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.