标签:blog http io ar strong on div art log
char strUsr[10] = "Hello"; TCHAR Name[100]; #ifdef UNICODE MultiByteToWideChar(CP_ACP, 0, strUsr, -1, Name, 100); #else strcpy(Name, strUsr); #endif
TCHAR转char
char* ConvertLPWSTRToLPSTR (LPWSTR lpwszStrIn) { LPSTR pszOut = NULL; if (lpwszStrIn != NULL) { int nInputStrLen = wcslen (lpwszStrIn); // Double NULL Termination int nOutputStrLen = WideCharToMultiByte (CP_ACP, 0, lpwszStrIn, nInputStrLen, NULL, 0, 0, 0) + 2; pszOut = new char [nOutputStrLen]; if (pszOut) { memset (pszOut, 0x00, nOutputStrLen); WideCharToMultiByte(CP_ACP, 0, lpwszStrIn, nInputStrLen, pszOut, nOutputStrLen, 0, 0); } } return pszOut; }
标签:blog http io ar strong on div art log
原文地址:http://www.cnblogs.com/meizixiong/p/4113477.html