title: Converting System::String to Const Char *
body: <p>I am using Visual C++ 2008's GUI creator to make a user interface. When a button is clicked, the following function is called. The content is supposed to create a file and name the file after the contents of the textbox "Textbox' with '.txt' at the end. However, that leads me to a conversion error. Here is the code:</p>
  
  <p><code>
  private: System::Void Button_Click(System::Object^  sender, System::EventArgs^  e) {
      ofstream myfile (Textbox->Text + ".txt");
      myfile.close();
  }
  </code></p>
  
  <p>Here is the error:</p>
  
  <blockquote>
    <p>error C2664: 'std::basic_ofstream&lt;_Elem,_Traits>::basic_ofstream(const char *,std::ios_base::openmode,int)' : cannot convert parameter 1 from 'System::String ^' to 'const char *'</p>
  </blockquote>
  
  <p>How can I do a conversion to allow this to go through?</p>