"Karthik" <karthik.t@gmai l.com> wrote in message
news:1121289967 .573625.124080@ g43g2000cwa.goo glegroups.com.. .[color=blue]
> Hello,
>
> How can I convert a BSTR data type to std::string??? Thanks a much!
>
> Karthik
>[/color]
Ask in a microsoft newsgroup. I believe BSTR is a microsoft-defined type.
(But, have you tried simply assigning from your BSTR variable to your
std::string variable, or creating a std::string with the BSTR as the
std::string's constructor's parameter?)
"Karthik" <karthik.t@gmai l.com> schrieb im Newsbeitrag
news:1121289967 .573625.124080@ g43g2000cwa.goo glegroups.com.. .[color=blue]
> How can I convert a BSTR data type to std::string??? Thanks a much![/color]
A BSTR - if you are talking about the Microsoft thing - basically is a
unicode string. To convert it into an std::string you have to use functions
like wcstombs or WideCharToMulti Byte. But you should better use std::wstring
instead of std::string, or you cannot convert all possible characters in a
BSTR.
Howard wrote:[color=blue]
> "Karthik" <karthik.t@gmai l.com> wrote in message
> news:1121289967 .573625.124080@ g43g2000cwa.goo glegroups.com.. .[color=green]
> > Hello,
> >
> > How can I convert a BSTR data type to std::string??? Thanks a much!
> >
> > Karthik
> >[/color]
>
> Ask in a microsoft newsgroup. I believe BSTR is a microsoft-defined type.[/color]
That's a good suggestion.
[color=blue]
> (But, have you tried simply assigning from your BSTR variable to your
> std::string variable, or creating a std::string with the BSTR as the
> std::string's constructor's parameter?)[/color]
I'm guessing that it probably won't work, based on what I read here:
Comment