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).
You can use stringstream's
int str2int (const string &str) { stringstream ss(str); int num; ss >> num; return num; }