Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <unistd.h>
  4. #include <signal.h>
  5.  
  6.  
  7. void callbackdertoue(int signal){
  8.     printf("\nLe contrôle-C est désactivé\n");
  9. }
  10.  
  11. int main(){
  12.     // Définition de structure
  13.     struct sigaction new_act;
  14.     // définition du handler et des opts
  15.     new_act.sa_handler=callbackdertoue;
  16.     new_act.sa_flags=0;
  17.     // Mise à 0 du masque des signaux
  18.     sigemptyset(&new_act.sa_mask);
  19.     // Postitionement du traitement du signal SIGINT
  20.     sigaction(SIGINT,&new_act,NULL);
  21.     printf("Je suis le process %d\n",getpid() );
  22.  
  23.     while(1) pause();
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement