0
我想连接两个bstr_t,一个是char'#',另一个是int(我将它转换为bstr_t)并将它作为bstr返回(例如'#' +'1234'为'#12345')。但是,在连接之后,最终结果只包含'#'。我不知道我在哪里犯错。连接两个Bstr字符串的C++代码
function(BSTR* opbstrValue)
{
_bstr_t sepStr = SysAllocString(_T("#"));
wchar_t temp_str[20]; // we assume that the maximal string length for displaying int can be 10
itow_s(imgFrameIdentity.m_nFrameId, temp_str, 10);
BSTR secondStr = SysAllocString(temp_str);
_bstr_t secondCComStr;
secondCComStr.Attach(secondStr);
_bstr_t wholeStr = sepStr + secondCComStr;
*opbstrValue = wholeStr.Detach();
}