What\'s the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of returning zero).
If you have C++11, the appropriate solutions nowadays are the C++ integer conversion functions in : stoi, stol, stoul, stoll, stoull. They throw appropriate exceptions when given incorrect input and use the fast and small strto* functions under the hood.
If you are stuck with an earlier revision of C++, it would be forward-portable of you to mimic these functions in your implementation.