Warning: main(topsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/catch_ctrl+c.html on line 13

Warning: main(topsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/catch_ctrl+c.html on line 13

Warning: main() [function.include]: Failed opening 'topsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/catch_ctrl+c.html on line 13


Warning: main(leftsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/catch_ctrl+c.html on line 16

Warning: main(leftsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/catch_ctrl+c.html on line 16

Warning: main() [function.include]: Failed opening 'leftsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/catch_ctrl+c.html on line 16

Displaying  Source Code(s)  
 


Warning: main(adsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/catch_ctrl+c.html on line 31

Warning: main(adsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/catch_ctrl+c.html on line 31

Warning: main() [function.include]: Failed opening 'adsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/catch_ctrl+c.html on line 31

 
Program to catch Ctrl+C.

--------------------------------------------------------------------------------



/*
* A small program that catches the ctrl-c(SIGINT) signal for the first time and prints
* a output rather but exits on pressing ctrl-c again
*/

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>

void sigfun(int sig)
{
printf("You have presses Ctrl-C , please press again to exit");
(void) signal(SIGINT, SIG_DFL);
}

int main()
{
(void) signal(SIGINT, sigfun);

while(1) {
printf("Hello World!<BR>);
sleep(1);
}

return(0);
}
 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG