[メモ] System::String^ → char*, wchar_t*, LPSTR, LPWSTR への変換 (C++/CLI) VS2005 C++/CLI で、アンマネージなライブラリを使う場合、ライブラリの関数の引数がアンマネージな文字列型(char*, wchar_t*, LPSTR, LPWSTR)の時がある。そんな時に必要な変換。 using namespace System::Runtime::InteropServices; //Marshal使うから //変換元 String ^srcStr = "Hello"; //char* char* dstChar; dstChar = (char*)(void*)Marshal::StringToHGlobalAnsi(srcStr); //wchar_t* wchar_t *dstWchar_t; int strLe