daily pastebin goal
71%
SHARE
TWEET

Untitled

a guest Jun 14th, 2012 24 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <signal.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. static void catch_function(int signal) {
  6.     puts("Interactive attention signal caught.");
  7. }
  8.  
  9. int main(void) {
  10.     if (signal(SIGINT, catch_function) == SIG_ERR) {
  11.         fputs("An error occurred while setting a signal handler.\n", stderr);
  12.         return EXIT_FAILURE;
  13.     }
  14.     puts("Raising the interactive attention signal.");
  15.     if (raise(SIGINT) != 0) {
  16.         fputs("Error raising the signal.\n", stderr);
  17.         return EXIT_FAILURE;
  18.     }
  19.  
  20.     while(1)
  21.     {
  22.  
  23.     }
  24.  
  25.     puts("Exiting.");
  26.     return 0;
  27. }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top