BSTR to char* and vice versa

U

Urs Vogel

Hi

What's sthe best approach to convert char[] or char* strings to a BSTR and
vice versa? I would like to omit OLE2A macros and allocate the memory
myself, or is the the only way? Any hints?

Thanks, Urs
 
J

Jochen Kalmbach

J

Jochen Kalmbach

Hi Jochen Kalmbach,
Hi Urs Vogel,
Hi

What's sthe best approach to convert char[] or char* strings to a BSTR
and vice versa? I would like to omit OLE2A macros and allocate the
memory myself, or is the the only way? Any hints?

If you want to do it by hand, then you can use:

See: WideCharToMultiByte
http://msdn.microsoft.com/library/en-us/intl/unicode_2bj9.asp

(which is also internally use by any other method)

Oh sorry... this was the wrong direction...

Please use: MultiByteToWideChar
http://msdn.microsoft.com/library/en-us/intl/unicode_17si.asp

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top