Board index » cppbuilder » MSXML3 : How can I create BSTR variable

MSXML3 : How can I create BSTR variable

How can I create a BSTR object with a char*

For example : BSTR bb = BSTR("abcd") compile and link
but the value of bb is always "????????????????????"

The MSXML documentation propose
BSTR bstrFeature = ::SysAllocString(_T("abcd"));
but I can't compile this line : Error can't convert char* to wchar_t*

 

Re:MSXML3 : How can I create BSTR variable


On Fri, 13 Jul 2001 14:49:48 +0100, Pascal PREVOST

Quote
<pascal.prev...@benettonformula.com> wrote:
>How can I create a BSTR object with a char*

>For example : BSTR bb = BSTR("abcd") compile and link
>but the value of bb is always "????????????????????"

>The MSXML documentation propose
>BSTR bstrFeature = ::SysAllocString(_T("abcd"));
>but I can't compile this line : Error can't convert char* to wchar_t*

Its not clear if your still using Borland C++5, if you are then

wstring left=L"abcd";

wstring is an stl class

Re:MSXML3 : How can I create BSTR variable


Pascal PREVOST schrieb:

Quote

> How can I create a BSTR object with a char*

> For example : BSTR bb = BSTR("abcd") compile and link
> but the value of bb is always "????????????????????"

> The MSXML documentation propose
> BSTR bstrFeature = ::SysAllocString(_T("abcd"));
> but I can't compile this line : Error can't convert char* to wchar_t*

Try this
        BSTR bb = WideString("test").Detach();
HTH
Uwe

Re:MSXML3 : How can I create BSTR variable


Use SysAllocStringByteLen() instead

    BSTR bstrFeature = ::SysAllocStringByteLen("abcd", 4);

Gambit

Quote
"Pascal PREVOST" <pascal.prev...@benettonformula.com> wrote in message

news:3B4EFC7C.DE881482@benettonformula.com...
Quote
> The MSXML documentation propose
> BSTR bstrFeature = ::SysAllocString(_T("abcd"));
> but I can't compile this line : Error can't convert char* to wchar_t*

Other Threads