我有一根绳子,xxxxxxxxxxxxxxxxxxx
我正在将字符串读入较小字符串的结构,并使用 substr 来解析它。我需要将其中一种字符串类型转换为整数。
atoi不适合我。我该怎么做?它说:
无法将 std::string 转换为 const char*
#include <iostream>
#include <string>
using namespace std;
void main();
{
string s = "453"
int y = atoi(S);
}
Run Code Online (Sandbox Code Playgroud)