Advertisement

05.06.2008 at 12:44PM PDT, ID: 23380711
[x]
Attachment Details

How to convert unmanaged char to string

Asked by JonMny in Microsoft Visual C++.Net, .NET

Tags: c++, microsoft

I have a dll that is compiled with win32 and clr functions.  I have a function that passes the following
char variable, const char* varible1, const char* var3

I want to convert all of these to System:string.  I am able to convert the const Char* without trouble but when I convert the char I get the numeric value instead of the character.  (example the variable is the drive letter - after converstion I get 101 in my string instead of 'e'.)

I am using this to convert the const Char*
 System::String ^ oId = Marshal::PtrToStringAnsi((IntPtr) (char *) var);

Start Free Trial
[+][-]05.06.2008 at 12:49PM PDT, ID: 21510399

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 03:15PM PDT, ID: 21511507

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C++.Net, .NET
Tags: c++, microsoft
Sign Up Now!
Solution Provided By: LordOfPorts
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.06.2008 at 07:31PM PDT, ID: 21512774

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628