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
You can do it the C++ way with boost::lexical_cast. If you really insist on not using boost you can just examine what it does and do that. It's pretty simple.
try
{
double x = boost::lexical_cast(str); // double could be anything with >> operator.
}
catch(...) { oops, not a number }