BSTR to char* and vice versa

  • Thread starter Thread starter Urs Vogel
  • Start date Start date
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
 
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/
 
Back
Top