0

我试图将 wstring 转换为 unsigned char。我试过_wtoc,但这不存在。

_wto 风格有转换吗?

谢谢你。

4

2 回答 2

0

好吧,我现在这样做:

wstring sThis=L"12";

unsigned int i;
i=_wtoi(sThis.c_str());

unsigned char c=(unsigned char)i;
于 2013-10-16T08:55:04.553 回答
-1

我这样做

wstring wsWideString
UINT uSize = wsWideString.length();
unsigned char * ptrUChar = new unsigned char[uSize+1];
memset(ptrUChar ,'\0',uSize+1);
for(UINT i=0;i<uSize;i++)
{
ptrUChar [i] = wsWideString[i];
}

//when finished
delete [] ptrUChar ;
ptrUChar  = NULL;
于 2013-10-16T09:20:33.293 回答