title: C++ - error while using atoi
body: <p>I am trying to use the <code>atoi</code> function in order to obtain conversion from <code>string</code> to <code>int</code>. The thing is that I have a string array which contains both integers and string values.</p>
  
  <p>From what I've read, in order to get the error code from it, the function must return 0 : </p>
  
  <pre><code>string s = "ssss";
  int i = atoi(s.c_str())
  if (i == 0)
      cout&lt;&lt;"error"&lt;&lt;endl;
  end;
  </code></pre>
  
  <p>How should I proceed if my string value is <code>0</code> ?</p>
  
  <p>Another issue is with this string : <code>string s = "001_01_01_041_00.png"</code>. The <code>atoi</code> function returns the value <code>1</code>. Shouldn't it return <code>0</code>. Why does it return <code>1</code>?</p>