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 - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -