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 scripting a language?
How do I run a bin bash script?
What are the various stages of a linux process it passes through?
What are the advantages of using shell scripts?
What is the default ubuntu terminal?
What is inside a seashell?
How do I save a powershell script?
What does $@ mean in shell?
How do you create a shortcut in linux?
How can you find out how long the system has been running?
What is bash used for?
How do I run a powershell script?
Explain about non-login shell files?
What are the two files of crontab command?
What is an inode block?