【发布时间】:2011-08-02 10:38:50
【问题描述】:
我正在使用 C++。我有一个包含以下数字的字符串
std::string s= "8133522648";
我想把这个数字转换成
long long int nr;
我做到了:nr=atoll(s.c_str()).result is: -456410944。如何解决这个错误?谢谢
编辑:
其实我有:
const char* str="8133523648";
I have to convert it into long long int nr=8133523648
感谢您的帮助!欣赏!
【问题讨论】:
-
您的意思是
std::string s = "8133522648";吗?还有atoll(s.c_str())? -
另外,nr=atoll(s) 不应该是 nr=atoll(s.c_str()) 吗?
-
你用的是什么编译器?您能否发布一个可编译的示例?!
标签: c++ int long-integer