title: ANSI C equivalent of try/catch?
body: <p>I have some C code I'm working with, and I'm finding errors when the code is running but have little info about how to do a proper try/catch (as in C# or C++).</p>
  
  <p>For instance in C++ I'd just do:</p>
  
  <pre><code>try{
  //some stuff
  }
  catch(...)
  {
  //handle error
  }
  </code></pre>
  
  <p>but in ANSI C I'm a bit lost.  I tried some online searches but I don't see enough info about how to make it happen / figured I'd ask here in case anyone can point me in the right direction.</p>
  
  <p>Here's the code I'm working with (fairly simple, recursive method) and would like to wrap with try/catch (or equivalent error-handling structure).</p>
  
  <p>However my main question is simply how to do a try / catch in ANSI C...the implementation / example doesn't have to be recursive.</p>
  
  <pre><code>void getInfo( int offset, myfile::MyItem * item )
  {
      ll::String myOtherInfo = item-&gt;getOtherInfo();
      if( myOtherInfo.isNull() )
          myOtherInfo = "";
      ll::String getOne = "";
      myfile::Abc * abc = item-&gt;getOrig();
      if( abc != NULL )
      {
          getOne = abc-&gt;getOne();
      }
      for( int i = 0 ; i &lt; offset ; i++ )
      {
               printf("found: %d", i);
      }
      if( abc != NULL )
          abc-&gt;release();
      int childCount = item-&gt;getChildCount();
      offset++;
      for( int i = 0 ; i &lt; childCount ; i++ )
          getInfo( offset, item-&gt;getChild(i) );
      item-&gt;release();
  }
  </code></pre>