System::Stringからchar*への変換。忘れませんように。

public ref class StringConverter
{
  char* m_str;
public:
  StringConverter(System::String^ Str)
  {
    m_str = (char*)(void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(Str);
  }

  ~StringConverter()
  {
    System::Runtime::InteropServices::Marshal::FreeHGlobal((System::IntPtr)m_str);
  }

  operator std::string()
  {
    return m_str;
  }
};