Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

BSTR to char

What is the best way to convert a bstr to char if there is one?

Example,

I have a COM object which has a method with a BSTR parameter. I next want
to call an API funtion which has a LPCTSTR parameter.

Is there any way to convert the bstr to the LPCTSTR?

Thanks,

JD
[313 byte] By [JD] at [2007-11-10 12:51:15]
# 1 Re: BSTR to char
"JD" <dahljn@interaccess.com> wrote:
>
>What is the best way to convert a bstr to char if there is one?
>
>Example,
>
>I have a COM object which has a method with a BSTR parameter. I next want
>to call an API funtion which has a LPCTSTR parameter.
>
>Is there any way to convert the bstr to the LPCTSTR?
>
>Thanks,
>
>JD

Look at this link on the msdn site. It lists all sorts of macros for converting
strings between different types.

http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_atl_string_conversion_macros.htm
msaad at 2007-11-11 20:41:44 >