How to BSTR* to std::string??

Jun 29, 2018 at 9:34am
I have a BSTR*. how to get the value from the BSTR* to std::string so that I can print it to console?

1
2
3
BSTR* ptr;
HRESULT result = objPtr->GetValue(ptr);
//need to print to console the value 
Jun 29, 2018 at 11:41am
A BSTR is a wchar_t so wcout should do it
Jun 29, 2018 at 3:35pm
BSTR has information before the text that describes the length of the string and has not terminator so I don't think wchar_t will do it. This article describes the process about a quarter of the way down: https://msdn.microsoft.com/en-us/library/ms235631.aspx
Topic archived. No new replies allowed.