将string类型转换为long long 类型
long long strtoll(const char *nptr,char **endptr,int base);
nptr是我们要转的字符串string对应的const char *对象。
endptr是按值传递时用的,如果用此函数的就设为NULL。
base是进位制数,应填10.
#include<iostream>
using namespace std;
int main()
{
string str = "789456123";
long long num;
num= strtoll(str.c_str(), NULL, 10);
cout << num<< endl;
return 0;
}
// 789456123