title: How to convert String^ to char array
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2178023/need-to-convert-string-to-char">Need to convert String^ to char *</a>  </p>
  </blockquote>
  
  
  
  <p>I have been looking so long for this solution but I can't find nothing specific. I work in Visual Studio C++, windows forms app. I need to convert <code>String^</code> value into char array. 
  I have stored value from <code>TextBox</code> in <code>String^</code>:</p>
  
  <pre><code>String^ target_str = targetTextBox-&gt;Text;
  
  // lets say that input is "Need this string"
  </code></pre>
  
  <p>I need to convert this <code>String^</code> and get output similar to this:</p>
  
  <pre><code>char target[] = "Need this string";
  </code></pre>
  
  <p>If it is defined as <code>char target[]</code> it works but I want to get this value from <code>TextBox</code>.</p>
  
  <p>I have tried marshaling but it didn't work. Is there any solution how to do this?</p>
  
  <p>I have found how to convert <code>std::string</code> to <code>char</code> array so another way how to solve this is to convert <code>String^</code> to <code>std::string</code> but I have got problems with this too. </p>