Solved

Convert char * -> bstr

Posted on 2004-09-24
4
793 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
ID: 12146090
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
ID: 12159728
Here the way i found:       

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Quicksort a dynamic deque 33 66
FMX enumerated colours 2 84
Task manager indicates my c++ program memory consumption is growing? 12 100
gdb doesn't stop on breakpoint 2 51
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

867 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

15 Experts available now in Live!

Get 1:1 Help Now