source of highlighter
plain | download
    1 // kompilacia: gcc -o priklad4 priklad4.c
    2 
    3 #include <errno.h>
    4 #include <stdio.h>
    5 #include <stdlib.h>
    6 #include <sys/types.h>
    7 #include <signal.h>
    8 
    9 void moj_handler (int signum) {
   10         int old_errno = errno;
   11 
   12         printf("CTRL + C - chces aby som skoncil co? :D\n", signum);
   13 
   14         errno = old_errno;
   15 }
   16 
   17 int main (int argc, char ** argv) {
   18         signal(SIGINT, moj_handler);
   19 
   20         char c;
   21 
   22         while (1) {
   23                 if (getchar() == 'p')
   24                         break;
   25         }
   26 
   27         exit(EXIT_SUCCESS);
   28 }