¿Cómo puedo convertir wstring a u16string?
Quiero convertirwstring
au16string
en C ++.
Puedo convertirwstring
para encadenar o revertir. Pero no sé cómo convertir au16string
.
u16string CTextConverter::convertWstring2U16(wstring str)
{
int iSize;
u16string szDest[256] = {};
memset(szDest, 0, 256);
iSize = WideCharToMultiByte(CP_UTF8, NULL, str.c_str(), -1, NULL, 0,0,0);
WideCharToMultiByte(CP_UTF8, NULL, str.c_str(), -1, szDest, iSize,0,0);
u16string s16 = szDest;
return s16;
}
Error en WideCharToMultiByte (CP_UTF8, NULL, str.c_str (), -1, szDest, iSize, 0,0); 'sszDest
. Causa deu16string
no se puede usar conLPSTR
.
¿Cómo puedo arreglar este código?