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

Popular posts from this blog

javascript - ScrollTo Effect (href to div) -

javascript - ng-class not responding to change in model in Angular? -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -