Solved

Convert char * -> bstr

Posted on 2004-09-24
4
781 Views
Last Modified: 2008-01-09
How can i convert a char * into a bstr?
0
Comment
Question by:mammouth
4 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 50 total points
Comment Utility
SysAllocString:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/htm/chap7_8r53.asp

But if you are in Visual C++ you can use:

BSTR str = CString("A char pointer or text").AllocSysString();
0
 
LVL 1

Author Comment

by:mammouth
Comment Utility
Here the way i found:       

CComBSTR bStr(Resultchr);
*Result = bStr.Detach();
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now