【发布时间】:2023-03-14 14:38:01
【问题描述】:
我正在尝试将 wchar_t * 转换为 BSTR。
#include <iostream>
#include <atlstr.h>
using namespace std;
int main()
{
wchar_t* pwsz = L"foo";
BSTR bstr(pwsz);
cout << SysStringLen(bstr) << endl;
getchar();
}
这会打印出0,这比我希望的要少。进行这种转换的正确方法是什么?
【问题讨论】: