I\'ve had quite a bit of trouble trying to write a function that checks if a string is a number. For a game I am writing I just need to check if a line from the file I am r
Could you simply use sscanf's return code to determine if it's an int?
bool is_number(const std::string& s) { int value; int result = sscanf(valueStr.c_str(), "%d", &value); return (result != EOF && readResult != 0); }