#include <csignal> void ( *signal( int signal, void (* func) (int)) ) (int);
The signal() function sets func to be called when signal is recieved by your program. func can be a custom signal handler, or one of these macros (defined in the csignal header file):
Some basic signals that you can attach a signal handler to are:
The return value of signal() is the address of the previously defined function for this signal, or SIG_ERR is there is an error.