Re: Prorblem assigning _variant_t to _bstr when _variant_t is an integer



if(tvar.vt == VT_NULL) b = "";
else b = tvar.bstrVal;

Try

b = (_bstr_t)tvar;

Any good?
In general, you don't to mess about with the guts of _variant_t and _bstr_t
but instead use the conversion constructors
provided for you.

std::cout << b;

That will not work. std::cout does not know about _bstr_t.
Change that to

std::cout << (const char *)b;

Stephen Howe


.