How can I convert an int to BSTR
I would like to convert an int to BSTR. I'm using createTextNode in MSXML which accepts BSTR. H开发者_如何学Cow can I do that please?
Probably not efficient but first convert to a string and then you can simply convert that (untested):
std::wstring convertToString(int value)
{
std::wstringstream ss;
ss << value;
return ss.str();
}
_bstr_t theConverted(convertToString(42).c_str());
int number = 123;
_bstr_t bstr = (long)number;
(Source)
Data Type Conversion Functions [Automation] (MSDN), see "Functions to convert to type BSTR" section.
精彩评论