- #include <signal.h>
- #include <stdio.h>
- #include <stdlib.h>
- static void catch_function(int signal) {
- puts("Interactive attention signal caught.");
- }
- int main(void) {
- if (signal(SIGINT, catch_function) == SIG_ERR) {
- fputs("An error occurred while setting a signal handler.\n", stderr);
- return EXIT_FAILURE;
- }
- puts("Raising the interactive attention signal.");
- if (raise(SIGINT) != 0) {
- fputs("Error raising the signal.\n", stderr);
- return EXIT_FAILURE;
- }
- while(1)
- {
- }
- puts("Exiting.");
- return 0;
- }
SHARE
TWEET
Untitled
a guest
Jun 14th, 2012
24
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data

