What is the approved way to convert from char* to System::string and back in C++/CLI? I found a few references to marshal_to<> templated functions on Google, but it appea
System::String has a constructor that takes a char*:
using namespace system;
const char* charstr = "Hello, world!";
String^ clistr = gcnew String(charstr);
Console::WriteLine(clistr);
Getting a char* back is a bit harder, but not too bad:
IntPtr p = Marshal::StringToHGlobalAnsi(clistr);
char *pNewCharStr = static_cast(p.ToPointer());
cout << pNewCharStr << endl;
Marshal::FreeHGlobal(p);