string UnicodeToWideChar(const wstring &str)
{
int nLen = WideCharToMultiByte(CP_ACP,0,str.c_str(),-1,NULL,0,NULL,NULL);
char *pStr = new char[nLen];
memset(pStr,0,sizeof(char)*nLen);
WideCharToMultiByte(CP_ACP,0,str.c_str(),-1,pStr,nLen,NULL,NULL);
string strText = pStr;
delete[] pStr;
pStr = NULL;
return strText;
}
wstring WideCharToUnicode(const string &str)
{
int nLen = MultiByteToWideChar(CP_ACP,0,str.c_str(),-1,NULL,0);
wchar_t *pStr = new wchar_t[nLen];
memset(pStr,0,sizeof(wchar_t)*nLen);
MultiByteToWideChar(CP_ACP,0,str.c_str(),-1,pStr,nLen);
wstring strText = pStr;
delete[] pStr;
pStr = NULL;
return strText;
}