set terminate function c++

Viewed 46

How can I save current function which is used by set_terminate and set new function in it? NOTE: I want to use pointers on function. I tried somenthing like this so far, but I'm now confused and don't know what to do:

How to send a pointer to a function, and its functionality is to terminate the current program and can I save current pointer on function that is used by set_terminate and how?


typedef void (*PF) ();
void empty() {
    cout << "empty" << endl;
    exit(-1);
}

int main() {

    PF set_terminate(PF pf);

    return 0;
}
0 Answers
Related