I would like to convert an int to BSTR. I'm using createTextNode in MSXML which accepts BSTR. How can I do that please?
+1
A:
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());
graham.reeds
2010-08-06 10:13:28
What is Converted on the last line?
Noppanit
2010-08-06 10:17:21
I'm sorry but I'm very new to C++
Noppanit
2010-08-06 10:18:14
Converted is just a variable name. Call it what you want. Just renamed it to remove any confusion. Also there was a couple of slight bugs to fix.
graham.reeds
2010-08-06 10:30:09
A:
Data Type Conversion Functions [Automation] (MSDN), see "Functions to convert to type BSTR" section.
adf88
2010-08-06 11:39:42