Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert char * to a System::string ^ [duplicate]

Tags:

string

c++-cli

Possible Duplicate:
What is the best way to convert between char* and System::String in C++/CLI

Hello, I have a function in a c++ project using \clr something like:

int WINAPI dmtTest(char *pcertificate) 
{    
    String^ sCertificate;    
    sCertificate = pcertificate; // how can I assign pcertificate to sCertificate?
    ....
}
like image 960
franco Avatar asked Aug 06 '10 13:08

franco


1 Answers

You can do:

String^ sCertificate;
sCertificate = gcnew String(pcertificate);
like image 119
jbernadas Avatar answered Nov 16 '22 02:11

jbernadas