Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <signal.h>
  3. #include <stdlib.h>
  4. #include <unistd.h>
  5.  
  6. void handler(int);
  7.  
  8. int main(void) {
  9. signal(SIGINT, handler);
  10. while (1)
  11. pause();
  12. return 0;
  13. }
  14.  
  15. void handler(int sig) {
  16. printf("Le contrôle-C est désactivé\n Quitter (q) ? : ");
  17. char c;
  18. c = getchar();
  19. if ('q' == c)
  20. exit(0);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement