c++ - Intercepting exit() -
i have class may this:
class streetsim{ public: void operator(){ //do cool things if(street_exploded) exit(5); } };
this works great small program this:
int main(){ streetsim ss; ss(); return 0; }
however want embed in program. not fork process child, i'm not allowed change streetsim
. prefer this:
int main(){ streetsim ss; int k = catch(ss()); if(k==5) fprintf("the street exploded!"); return k; }
is @ possible catch program exit signal this? suspect not, perhaps gurus here might have useful tribal knowledge this.
Comments
Post a Comment