_bstr_b 范围问题是多少啊?MSDN上说:_bstr_t( char* s2 ) Constructs a _bstr_t object by calling SysAllocString to create a new BSTR object and encapsulate it. This constructor first performs a multibyte to Unicode conversion.
If s2 is too large, you may generate a stack overflow error. In such a situation, convert your char* to a wchar_t with MultiByteToWideChar and then call the wchar_t * constructor
那么,我想知道这个更s2的最大长度是多少啊?
If s2 is too large, you may generate a stack overflow error. In such a situation, convert your char* to a wchar_t with MultiByteToWideChar and then call the wchar_t * constructor
那么,我想知道这个更s2的最大长度是多少啊?
//msdn上的解释,是由于如果s2是多字节字符的话,在转换为unicode时,会产生栈空间溢出,直接使用wchar_t*转换为_bstr_t 不会有这个问题。也就是说,当你的字符串为char*时,先使用MultiByteToWideChar转换为wchar_t*,再转为_bstr_t.