title: std::rename() file wont work when using a char variable as arguments (string converted to char)
body: <p>I tried it without adding the <code>"\""</code> on the beginning and end of the string <code>tablename4</code> and <code>tablename5</code> before converting it to char, and the <code>rename()</code> function still wouldn't work. It does work by just putting in the actual file name as rename() arguments, but thats not what i want, i want to use char variables</p>
  
  <p><strong>Full compiling code:</strong></p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;  
  #include &lt;iomanip&gt;
  #include &lt;stdio.h&gt;
  using namespace std;
  using std::string;
  
  int main()
  {
  
      std::string tablename4 = "hello.txt";
      ifstream in4(tablename4);
      ofstream out8("temp2.txt");
  
      std::string convertthis2;
      convertthis2 = "\"" + tablename4 + "\"";
      char * tochar2 = new char[convertthis2.length()];
      strcpy_s(tochar2, (convertthis2.length() + 1), convertthis2.c_str());
  
      std::string convertthis3;
      std::string tablename5 = "temp2.txt";
      convertthis3 = "\"" + tablename5 + "\"";
      char * tochar3 = new char[convertthis3.length()];
      strcpy_s(tochar3, (convertthis3.length() + 1), convertthis3.c_str());
      in4.close();
      out8.close();
      rename(tochar3, tochar2);
  
      //below is testing to see if it converted right, but these print out fine, as "hello.txt" and "temp2.txt"
      //but i tried it with and without the quotation marks, rename() still doesnt work
      cout &lt;&lt; tochar2 &lt;&lt; "     " &lt;&lt; tochar3;
  
      return 0;
  }
  </code></pre>