/*wchar_t* 转 char**/
wchar_t* AnsiToUnicode(const char* szStr)
{
int len;
len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szStr, -1, NULL, 0);
if(len == 0)
{
return NULL;
}
wchar_t* data = new wchar_t[len];
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szStr, -1, data, len );
return data;
}
/* char* 转wchar_t* */
char* UnicodeToAnsi(const wchar_t* szStr)
{
int nLen;
nLen = WideCharToMultiByte( CP_ACP, 0, szStr, -1, NULL, 0, NULL, NULL );
if (nLen == 0)
{
return NULL;
}
char* pResult = new char[nLen];
WideCharToMultiByte( CP_ACP, 0, szStr, -1, pResult, nLen, NULL, NULL );
return pResult;
}