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

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -