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


Please Help Members By Posting Answers For Below Questions

What language is shell scripting?

578


How will you connect to a database server from linux?

550


c program which behaves like a shell(command interpreter). it has its own prompt say "NewShell$".any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command

4681


What is echo in shell?

630


What is $1 in shell scripting?

583






What is shell chemistry?

529


What are the advantages of using shell scripts?

572


What is the command to find out users on the system?

566


What is a shell script in windows?

579


Why is it called a shell?

499


What is shell geeksforgeeks?

585


What does $$ mean in shell script?

569


Write the syntax for "if" conditionals in linux?

587


What command needs to be used to take the backup?

524


What is bash eval?

540