c program the catches the ctrl-c(SIGINT) Signal for the
first time and prints a output rather and exit on pressing
Ctrl-C again
Answer Posted / rakesh
#include <stdio.h>
#include <signal.h>
void sigproc(void);
main()
{
signal(SIGINT, sigproc);
printf("This program catches ctrl-c(SIGINT) signal for
first time and exit on pressing ctrl-c again\n");
for(;;);
/* infinite loop */
}
void sigproc()
{
signal(SIGINT, sigproc);
printf("you have pressed ctrl-c \n");
(void) signal(SIGINT,SIG_DFL);
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is shell script a programming language?
What language is used in terminal?
What are the various stages of a linux process it passes through?
Determine the output of the following command: [ -z “” ] && echo 0 || echo 1
How do I save a powershell script?
What is the use of a shebang line?
How do I set bash as default shell mac?
What is mac default shell?
What lives in a shell?
What is shell environment?
What are the different variables present in linux shell?
What is shell application?
What does $0 mean in shell script?
What is bash command used for?
How to find all the files modified in less than 3 days and save the record in a text file?