나는 작은 문자열의 구조에 문자열을 읽기, 그것을 구문 분석 SUBSTR을 사용하고 xxxxxxxxxxxxxxxxxxx
변환 문자열은 C++
문자열을 가지고에서 int로. 이러한 문자열 유형 중 하나를 정수로 변환해야합니다.
atoi
이 나를 위해 작동하지 않습니다. 어떤 아이디어? 그것은 cannot convert std::string to const char*
감사
#include<iostream>
#include<string>
using namespace std;
void main();
{
string s="453"
int y=atoi(S);
}
'atoi' 당신이 성공적으로 변환 된 것을 확인해야하는 경우 사용할 수있는 아주 좋은 기능이 아닌, 사용하기 더 좋은 일이 될 것'strtol' : [Documentation] (http://www.cplusplus.com/reference/cstdlib/strtol/) – Rogue