title: How to convert a handle string to a std::string
body: <p>I am trying to convert a handle string to a normal string. I though the method I was using was working, but when I look in the debugger it appears that half of my string has been chopped off on the line that creates the chars variable. Any idea why and what the proper way to convert a handle string to a normal string woudl be?</p>
  
  <pre><code>std::string convert(String^ s) {
      const char* chars = (const char*)(System::Runtime::InteropServices::Marshal::
          StringToHGlobalAnsi(s)).ToPointer();
      string myNewString = std::string(chars);
      return myNewString;
  }
  </code></pre>