I try to convert the last char of a CString to int using CString::GetAt() and _tstoi() but the compiler returns me error C2065: '_tstoi' : undeclared identifier. I guess i have to include a header file, i’ve tried #include "tchar.h" with no succes.
CString str = "something2";
int index = 0;
if (!str.IsEmpty())
{
index = _tstoi((char*)str.GetAt(str.GetLength() - 1));
}
EDIT: I use VC++ 6.0
This function under VC6 is _ttoi rather than _tstoi (still included in the header ‘tchar.h’)