/******************************************************************************************
Function: ConvertCharToLPWSTR
Description: const char *转LPWSTR
Input: str:待转化的const char *类型字符串
Return: 转化后的LPWSTR类型字符串
*******************************************************************************************/
LPWSTR ConvertCharToLPWSTR(const char * szString)
{
int dwLen = strlen(szString) + 1;
int nwLen = MultiByteToWideChar(CP_ACP, 0, szString, dwLen, NULL, 0);//算出合适的长度
LPWSTR lpszPath = new WCHAR[dwLen];
MultiByteToWideChar(CP_ACP, 0, szString, dwLen, lpszPath, nwLen);
return lpszPath;
}C++类型转换 const char *转LPWSTR
最新推荐文章于 2024-05-30 11:00:12 发布
本文介绍了一种将const char*类型的字符串转换为LPWSTR类型的方法。通过使用MultiByteToWideChar函数,该函数首先计算出宽字符所需的缓冲区大小,然后完成实际的转换过程。
2671

被折叠的 条评论
为什么被折叠?



