title: C++ file-redirection
body: <p>For faster input, I read that you can do <code>file-redirection</code> and include a file with the <code>cin</code> inputs already set.</p>
  
  <p>In theory it should be used like following:</p>
  
  <pre><code>App.exe inputfile outputfile
  </code></pre>
  
  <p>As far as I understood from C++ Primer book, The following C++ code[1] should be reading <code>cin</code> input from the text file and shouldn't need to any other special indication like[2]</p>
  
  <p>[2]</p>
  
  <pre><code>include &lt;fstream&gt;
  ofstream myfile;
  myfile.open ();
  </code></pre>
  
  <p>[1] The following C++ code...</p>
  
  <pre><code>#include &lt;iostream&gt;
  int main()
  {
      int val;
      std::cin &gt;&gt; val; //this value should be read automatically for inputfile
      std::cout &lt;&lt; val;
      return 0;
  }
  </code></pre>
  
  <p>Am I missing something?</p>