Unicode CString conversion to int
Hello, if I try to convert a CString object to int in Multibyte character set mode, I face no problem.
Code:
CString strNumber = _T("1234");
int nNumber = atoi(strNumber.GetBuffer(strNumber.GetLength()));
cout << nNumber <<endl;
But if I go for unicode character set, I get the following error.
error C2664: 'atoi' : cannot convert parameter 1 from 'unsigned short *' to 'const char *'
How can I succeed with the conversion? Thanks.
Rate the posts which you find useful