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
Answers were Sorted based on User's Feedback
Answer / 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 |
How are shells born?
How do I edit a .sh file?
How to declare functions in unix shell script?
What is the use of echo in shell script?
What does the sh command do?
What can scripts do?
Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.
What does $$ mean in shell script?
How does shell scripting work?
What is difference between bash and shell?
How do I open the shell in cmd?
How would you replace the n character in a file with some xyz?