C \ C++

[C++] stoi()

인디아나쥰이 2021. 2. 11. 23:09

std::stoi

string 혹은 wstring 문자열 base 진법을 사용하는 부호 있는 정수로 변환한 값을 리턴한다. 이 때, 변환 과정에서 문자를 읽었는지는 pos 에 저장된다.

 

헤더 : #include <string>  

 

syntax : int stoi (const string& str, size_t* idx = 0, int base = 10);

             int stoi (const wstring& str, size_t* idx = 0, int base = 10);

 

 

간단히 말하면 string 을 int형으로 변환해주는 함수

728x90
반응형