wstring转换为string
wstring wstr=_T("你猜你猜");
int size=WideCharToMultiByte(CP_ACP,0,wstr.c_str(),-1,NULL,0,NULL,NULL);
char *ch=new char[size+1];
if(!WideCharToMultiByte(CP_ACP,0,wstr.c_str(),-1,ch,size,NULL,NULL))
{
return false;
}
wstring wstr=_T("你猜你猜");
int size=WideCharToMultiByte(CP_ACP,0,wstr.c_str(),-1,NULL,0,NULL,NULL);
char *ch=new char[size+1];
if(!WideCharToMultiByte(CP_ACP,0,wstr.c_str(),-1,ch,size,NULL,NULL))
{
return false;
}
string str=ch;