Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - raise http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   raise

   Usage
   #include <signal.h>
   int raise(int sig);

   Description
   raise issues a signal to the executing program. The signal type,  sig,
   is  discussed in the signal description. When the signal is raised  by
   the  raise function call, the current signal-handling routine will  be
   called. See signal for complete description.

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

   void div_zero(int val)
   {
        printf("Divide by zero detected!\n");
        exit(0);
   }

   main()
   {
   float numerator = 3.0;
   float denominator = 0.0;
        if(signal(SIGFPE,*div_zero) == SIG_ERR)
        {
             printf("Could not set SIGFPE!\n");
             abort();
        }

        if(denominator == 0)
             raise(SIGFPE);
        else
             printf("The result of the division is %f\n",
                       numerator/denominator);
   }

   Return Value
   Returns 0 if successful, otherwise returns a non-zero value.


See Also: signal

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