c++ * to string and string to *

#include <sstream>

string ltos(long l)
{
ostringstream os;
os << l;
string result;
istringstream is(os.str());
is >> result;
return result;
}


long stol(string str)
{
long result;
istringstream is(str);
is >> result;
return result;
}
std::to_string
 unsigned long ul = std::stoul (str,nullptr,0);
原文地址:https://www.cnblogs.com/mignet/p/14193494.html