WChar to Char

//字符串中可包含中文
 char* CStringToChar(CString cstr)
{
	DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, cstr, -1, NULL, 0, NULL, FALSE);

	char* CurrentPath = new char[dwNum];
	memset(CurrentPath, 0, sizeof(CurrentPath));
	WideCharToMultiByte(CP_OEMCP, NULL, cstr, -1, CurrentPath, dwNum, NULL, FALSE);

	return CurrentPath;
}

你可能感兴趣的:(char,wchar)