记得用完之后free掉
CHAR转WCHAR:
WCHAR * charToWCHAR(char *s) {
int w_nlen = MultiByteToWideChar(CP_ACP, 0, s, -1, NULL, 0);
WCHAR *ret;
ret = (WCHAR*)malloc(sizeof(WCHAR)*w_nlen);
memset(ret, 0, sizeof(ret));
MultiByteToWideChar(CP_ACP, 0, s, -1, ret, w_nlen);
return ret;
}
WCHAR转CHAR:
CHAR* wcharToCHAR(WCHAR *s) {
int w_nlen = WideCharToMultiByte(CP_ACP, 0, s, -1, NULL, 0, NULL, false);
CHAR *ret = (CHAR*)malloc(w_nlen * sizeof(CHAR));
memset(ret, 0, w_nlen);
WideCharToMultiByte(CP_ACP, 0, s, -1, ret, w_nlen, NULL, false);
return ret;
}