Hi all please tell me how can i convert CString to const wchar_t *.
thanks.
Printable View
Hi all please tell me how can i convert CString to const wchar_t *.
thanks.
If you compile in Unicode mode, your CStrings will be wide, and you can use the standard cast operator:
In 8-bit MBCS mode you can declare a wide CString as CString<wchar_t>.Code:CString cs(L"Hello world");
TCHAR szBuffer[200];
_tcscpy(szBuffer, cs);
If you have an 8-bit CString you can use the conversion macros USES_CONVERSION and A2W() to convert the contents to wide characters.
Or use a _bstr_t variable, which is a dual-mode string.