How to BSTR* to std::string??

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 
A BSTR is a wchar_t so wcout should do it
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.