开发者

How can I convert an int to BSTR

开发者 https://www.devze.com 2023-01-10 23:28 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消