文字列をint型の数値に変換するには従来通りatoi系の関数が利用できる。変換元の文字列の型に応じてatoi、_wtoi、_ttoiを使い分けるといい。
bool Test()
{
////////////////////////////////
// 10進数表記の文字列をint型数値に変換
//
{
//char型文字列から変換
int nValue;
char pszText[] = "123";
nValue = ::atoi(pszText);
}
{
//wchar_t型文字列から変換
int nValue;
wchar_t pszText[] = L"123";
nValue = ::_wtoi(pszText);
}
{
//TCHAR型文字列から変換
int nValue;
TCHAR pszText[] = _T("123");
nValue = ::_ttoi(pszText);
}
{
//CString型文字列から変換
int nValue;
CString strText = _T("123");
nValue = ::_ttoi(strText);
}
return true;
}