// windows原理001.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include<windows.h> //宽字符转为多字符(Unicode-->ASCⅡ) #define WCHAR_TO_CHAR(lpW_Char,lpChar) WideCharToMultiByte(CP_ACP,NULL,lpW_Char,-1,lpChar,_countof(lpChar),NULL,FALSE);//多字符转为宽字符 #define CHAR_TO_WCHAR(lpChar,lpW_Char) MultiByteToWideChar(CP_ACP,NULL,lpChar,-1,lpW_Char,_countof(lpW_Char)); int _tmain(int argc, _TCHAR* argv[]) { WCHAR wTemp[20] = L"dadads"; char Temp[20] = {}; WCHAR_TO_CHAR(wTemp, Temp); printf("%s", wTemp); system("pause"); return 0; }