[C++]AnsiString to BSTR

Status
Not open for further replies.

Cortex

Full Member level 3
Joined
Mar 26, 2005
Messages
182
Helped
12
Reputation
24
Reaction score
4
Trophy points
1,298
Location
Morocco
Activity points
2,733
ansistring to bstr

IN C++ Builder
i want to convert a Ansistring (a editbox) to a BSTR

i already know how to make a BSTR

BSTR temp;
temp = SysAllocString(L"My text");

but i want to put random text
so how can i do it
Thanks in advance
 

convert ansistring to bstr

AnsiString str;
BSTR wstr;

str="Hello";

wstr=(BSTR)WideString(str);
 

    Cortex

    Points: 2
    Helpful Answer Positive Rating
bstr c++ builder

Thanks for your help
i used (TVariant) it better
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…