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++ 3.0r4 - <b>raise</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
raise

Usage

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

   ANSI

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 a complete description.

Example 

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

   #include <stdlib.h>

   #ifdef __cplusplus
   extern "C"
   #endif
   void div_zero(int val)
   {
       printf("Divide by zero detected!\n");
       exit(EXIT_SUCCESS);
   }

   int main()
   {
       float numerator = 3.0, 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 EXIT_SUCCESS;
   }

Return Value

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

See Also

   signal



See Also: signal

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