Also if you are compiling on a C++11 compatible compiler there are also the stoX series of functions. However for greater compatibility you would probably be better off using the stringstream solution, that works with all standard compliant C++ compilers.

Jim