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 will you pass and access arguments to a script in linux?
What does $@ mean in shell?
What is the fastest scripting language?
How to make userdefined variables to available for all other shells?
What is mac default shell?
What language is bash written in?
How can the contents of a file inside jar be read without extracting in a shell script?
How do we create command aliases in a shell?
Is shell scripting a programming language?
Hi All, Is it possible to create one file name only space or space in file name in UNIX and we can able to run that on Unix?
How will you print the login names of all users on a system?
Print the 10th line without using tail and head command.