raise

De RAD Studio
Aller à : navigation, rechercher

Remonter à Signal.h - Index


Header File

signal.h

Category

Process Control Routines

Prototype

int raise(int sig);

Description

Sends a software signal to the executing program.

raise sends a signal of type sig to the program. If the program has installed a signal handler for the signal type specified by sig, that handler will be executed. If no handler has been installed, the default action for that signal type will be taken.

The signal types currently defined in signal.h are noted here:

SIGABRT

Abnormal termination

SIGFPE

Bad floating-point operation

SIGILL

Illegal instruction

SIGINT

Ctrl-C interrupt

SIGSEGV

Invalid access to storage

SIGTERM

Request for program termination

SIGUSR1

User-defined signal

SIGUSR2

User-defined signal

SIGUSR3

User-defined signal

SIGBREAK

Ctrl-Break interrupt



Remarque :  SIGABRT isn’t generated by C++Builder during normal operation. It can, however, be generated by abort, raise, or unhandled exceptions.

Return Value

On success, raise returns 0.

On error it returns nonzero.

Example



 #include <signal.h>
 int main(void)
 {
     int a, b;
     a = 10;
     b = 0;
     if (b == 0)
     /* preempt divide by zero error */
        raise(SIGFPE);
     a = a / b;
     return 0;
 }



Portability



POSIX Win32 ANSI C ANSI C++

+

+

+

+