1.头文件中要定义宏;
#define UNICODE
#define _UNICODE
2.char转换成wchar
const char *pFilePathName = "c://aa.dll";
int nLen = strlen(pFilePathName) + 1;
int nwLen = MultiByteToWideChar(CP_ACP, 0, pFilePathName, nLen, NULL, 0);
TCHAR lpszFile[256];
MultiByteToWideChar(CP_ACP, 0, pFilePathName, nLen, lpszFile, nwLen);
3.wchar转换成char
char *pFilePathName;
TCHAR lpszFile[256];
_tcscpy(lpszFile, _T("c://aa.dll"));
int nLen = wcslen(wstr)+1;
WideCharToMultiByte(CP_ACP, 0, lpszFile, nLen, pFilePathName, 2*nLen, NULL, NULL);
char 与 wchar之间的转换
最新推荐文章于 2023-08-09 08:45:38 发布