if you don't have c++11, no problem, you can use the atoi function.
It takes a c string as parameter returns an int, if you have a std::string just do
int myInt = atoi( myString.c_str() );
Yea I know, thanks though. it's for both University Projects and to teach myself. It had been a while since I've worked exclusively with C++ so I wanted to try to get myself used to working with std::stringstreams again.
Since you're using a stringstream you can just use rdbuf()->in_avail() after you extract the number. If in_avail() returns true, then there's stuff left in the buffer, which means that part of it didn't parse as a number. This assumes that you've already stripped out the whitespace anyways.
Thanks! I'll have to do some quick research on that function! I'll look into it now!
Thanks everyone! Just wanted to learn some other and/or better ways to do some quick things. Thanks for the suggestions!