Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>signal() specify signal handler</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 signal()                Specify Signal Handler

 #include   <signal.h>

 void (*signal(signl, void (*func) signl[,subcode])))(int);
 int signl;     Type of signal you intend to handle
 int subcode;   Signal subcode

        This function lets you install a function to handle signal events
        such as abnornal termination or arithmetic errors. You can either
        install your own function or use one of these defaults:

                    SIG_DFL     Default action
                    SIG_IGN     Ignore action
                    SIG_ERR     Error return

        The possible signals to intercept are:

                    SIGABRT     Abnormal termination
                    SIGFPE      Floating point error
                    SIGILL      Illegal instruction
                    SIGINT      .nterrupt
                    SIGSEGV     Illegal storage access
                    SIGTERM     Request for program termination

       Returns:     A pointer to the previous handler if successful;
                    SIG_ERR otherwise.

   -------------------------------- Example ---------------------------------

        This example installs a signal handler routine for SIGFPE,
        and prints: "Floating Point Error!" when it is called.

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

 void Handler(int *reglist)

    printf("Floating Point Error!\n");


 int main(void)

    signal(SIGFPE, Handler);
    return 0;



See Also: abort() longjmp() raise() setjmp()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson