Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // sinal
- // Apple Xcode
- // paulogp
- #include <stdio.h>
- #include <unistd.h>
- #include <stdlib.h>
- #include <time.h>
- #include <signal.h>
- void myhandler(int signum)
- {
- printf("entrada na funcao\n");
- }
- int main (int argc, const char * argv[])
- {
- printf("inicio do processo\n");
- // ignorar um sinal: signal(nome_do_sinal, SIG_IGN)
- signal(SIGPIPE, SIG_IGN);
- struct sigaction act;
- act.sa_handler = myhandler;
- act.sa_flags = 0;
- sigemptyset(&(act.sa_mask));
- sigaction(SIGINT, &act, NULL);
- printf("fim do processo\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement