October 22, 2010

String Conversion C++ C#

C++/CLi to C#
std::string str = ...; 
System::String^ mgdstr = gcnew System::String(str.c_str();
and the other way
C# to C++
System::String^ value = ...;
CString cstr(value);
const std::string converted(cstr);

No comments: