Instead of this function, use boost::lexical_cast.

In any file needing it, add the following include to the top of the file:
#include <boost/lexical_cast.hpp>

Then use it like this: "boost::lexical_cast<int>(number)" where number is a string.