Below program ignores the CTRL + C signal,
test.c
#include < stdio.h >
#include < signal.h >
main()
{
signal(SIGINT,SIG_IGN);
while(1)
printf("You can't kill me with SIGINT anymore, dude\n");
return 0;
}
gcc test.c -o testout
./testout
Running the above program completely ignores the CRTL + C command and keep on running with out aborting. CRTL + C sends the SIGINT signal and we ignore that in program.
No comments:
Post a Comment