Arun
First problem is that std::string is based on char while BSTR is basically a
string of wchar_t, but if you can use _bstr_t, conversion will by quite
simple. Since you mention BSTR*, I assume that it is an [out] parameter of
some method.
HRESULT SomeClass::SomeMethod(BSTR* result)
{
std::string str = "...";
_bstr_t bstr = str.c_str();
*result = bstr.Detach();
return S_OK;
}
Of cause, you could also use MultiByteToWideChar and SysAllocString,
CComBSTR or A2BSTR, but to avoid all those conversions, I usually suggest to
use Unicode instead of ANSI (or any other MBCS) inside a COM server.
HTH
Heinz