string 转换为 LPCWSTR

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/mpp_king/article/details/89468003
	LPCWSTR stringToLPCWSTR(std::string orig)
	{
		size_t origsize = orig.length() + 1;
		size_t convertedChars = 0;
		wchar_t *wcstring = (wchar_t *)malloc(sizeof(wchar_t)*(orig.length()-1));
		mbstowcs_s(&convertedChars, wcstring, origsize, orig.c_str(), _TRUNCATE);

		return wcstring;
	}

猜你喜欢

转载自blog.csdn.net/mpp_king/article/details/89468003