The variable 'csIndex' is a unicoce string(wchar_t
), while the macro LPCSTR is for the ansi string (char
).
So you should use Unicode functions, the code will be:
lIndex = _wtoi((LPCWSTR)csIndex.Mid(3));
There's no problem with this line:
csIndex = (LPCSTR)(_bstr_t)vtIndex;
It is because that the smart pointer type _bstr_t can handle char*/wchar_t* conversion automatically.