开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜