有没有替代方案,要么内置到 Windows 中,要么与 apache 许可证兼容,以 stoll()对于 Visual Studio 2008。即使安装 Windows 7 平台 SDK 也不会将 stoll() 添加到字符串 header 。
在 unix 上,相同的函数被调用 strtoll() .
最佳答案
您可以使用_strtoi64
。它在 stdlib.h
中声明。
long long num = _strtoi64(str, NULL, 10);
类似于strtoll
,您可以传递 char ** endptr
作为第二个参数。如果是这样,*endptr
将被设置为第一个无效字符(可能是正常的空终止符)。
关于c++ - Visual Studio 2008 中是否有 stoll()/stroll() (字符串到 long long)替代方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3106026/