Solved

Convert char * -> bstr

Posted on 2004-09-24
4
819 Views
Last Modified: 2008-01-09
How can i convert a char * into a bstr?
0
Comment
Question by:mammouth
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

730 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