I am trying to use the atoi function to get the conversion from string to int . The thing is, I have a string array that contains both integers and string values.
From what I read in order to get the error code from it, the function should return 0:
string s = "ssss"; int i = atoi(s.c_str()) if (i == 0) cout<<"error"<<endl; end;
How do I proceed if my string value is 0 ?
Another problem is with this line: string s = "001_01_01_041_00.png" . The atoi function returns 1 . If it does not return 0 . Why does it return 1 ?
Simon
source share