title: How can I convert vector<string> to char* arr[]?
body: <p>Recently I want to convert vector to char* array[].</p>
  
  <p>So I had found the solution. But It was not safety way..</p>
  
  <p>Here is my code</p>
  
  <pre><code>char** arr = new char* [4];
  
  vector&lt;string&gt; vv;
  
  // setting strings
  for (int i = 0 ;i &lt; 4; i++)
  {
      vv.emplace_back("hello world");
  }
  // convert
  for (int i = 0; i &lt; 4; i++)
  {
      arr[i] = new char[vv[i].size()];
      memcpy(arr[i], vv[i].c_str(), vv[i].size());
  }
  
  // prints
  for (int i = 0; i &lt; 4; i++)
  {
      cout &lt;&lt; arr[i] &lt;&lt; endl;
  }
  
  // output
  // hello world羲羲?솎솨
  // hello world羲羲拂솽솨
  // hello world羲羲
  // hello world羲羲?펺솨
  
  // delete memorys
  for (unsigned index = 0; index &lt; 4; ++index) {
      delete[] arr[index];
  }
  
  delete []arr;
  </code></pre>
  
  <p>Why does it happen string crash??
  Is there no safe way anymore?</p>