Hi,
Given below is a sample pgm which I read in a book. Acc, to the book, this pgm should call function ‘abc’ the 1st time Ctrl^C is pressed & when Ctrl^C is pressed 2nd time it should terminate the pgm. But when I tried executing the same pgm in Linux, every time, Ctrl^C was pressed, the pgm called ‘abc’ function & went in infinite loop.
Could anyone tell me why did this happen & what is the default beavior?
#include<signal.h>
void abc();
main()
{
printf(“Press Key\n”);
signal(SIGINT,abc);
for(;;
}
void abc()
{
printf(“U have pressed the key”):
}
Thanx,
N
Given below is a sample pgm which I read in a book. Acc, to the book, this pgm should call function ‘abc’ the 1st time Ctrl^C is pressed & when Ctrl^C is pressed 2nd time it should terminate the pgm. But when I tried executing the same pgm in Linux, every time, Ctrl^C was pressed, the pgm called ‘abc’ function & went in infinite loop.
Could anyone tell me why did this happen & what is the default beavior?
#include<signal.h>
void abc();
main()
{
printf(“Press Key\n”);
signal(SIGINT,abc);
for(;;
}
void abc()
{
printf(“U have pressed the key”):
}
Thanx,
N