title: system("pause") won't work with freopen
body: <p>See below in comment.</p>
  
  <pre><code>int main(){
      //freopen("input.txt","r",stdin);//if I uncomment this line the console will appear and disappear immediately
      int x;
      cin&gt;&gt;x;
      cout&lt;&lt;x&lt;&lt;endl;
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>How to make it work?</p>