Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

BSTR to char* and vice versa

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Urs Vogel - 19 Mar 2005 18:48 GMT
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
Jochen Kalmbach - 19 Mar 2005 19:07 GMT
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)

Signature

Greetings
 Jochen

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

Jochen Kalmbach - 19 Mar 2005 19:12 GMT
Hi Jochen Kalmbach,

> Hi Urs Vogel,
>
[quoted text clipped - 10 lines]
>
> (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

Signature

Greetings
 Jochen

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.