title: C++ copying another file
body: <p>i was wondering how to use c++ ifstream/ofstream to copy a file and save it as another name.</p>
  
  <p>this is as far as i got. I know how to get the file, its just that i don't know how to copy that file and save it as a different name. </p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;fstream&gt;
  #include&lt;string&gt;
      namespace std;
  int main()
      {
      ofstream
      ifstream
      cout &lt;&lt; "enter your file you want to copy"&lt;&lt; endl;
      cin &gt;&gt; input_file_name;
      in_file.open(input_file_name);
      if (!in_file)
      {
      cout &lt;&lt;" there is no such file"&lt;&lt;endl;
      return 0;
      }
      cout &lt;&lt;" enter the name you want to save this copy file"&lt;&lt;endl;
      cin &gt;&gt; output_file_name;
      out_file.open(output_file_name);
      if (!out.file)
      {
      cout&lt;&lt;"file is not available"&lt;&lt;endl;
      return 0;
      }
      in_file.close();
      out_file.close();
      return 0;
  }
  </code></pre>