title: How to convert from a string array to a char array array?
body: <p>I want to pass an array of arguments to exec() function. The current parameters are all strings. How could I convert the array of string into the array of char array?</p>
  
  <p>Right now I'm using const_cast to remove the const. The code does not look nice.
  Is there a better solution?</p>
  
  <p>Sample code looks like:</p>
  
  <pre><code>void f(const string &amp;dev, const string &amp;status){
  
    char* args[] = {"link", "set", "dev", const_cast&lt;char*&gt;(dev.c_str()), 
    const_cast&lt;char*&gt;(status.c_str())};
    execv("/sbin/ip", args);
  }
  </code></pre>