title: Invoking C compiler using Python subprocess command
body: <p>I am trying to compile a C program using Python and want to give input using "&lt;" operator but it's not working as expected.
  If I compile the C program and run it by giving input though a file it works; for example</p>
  
  <pre><code>./a.out &lt;inp.txt works
  </code></pre>
  
  <p>But similarly if I try to do this using a Python script, it did not quite work out as expected.
  For example:</p>
  
  <pre><code>import subprocess
  subprocess.call(["gcc","a.c","-o","x"])
  subprocess.call(["./x"])
  </code></pre>
  
  <p>and</p>
  
  <pre><code>import subprocess
  subprocess.call(["gcc","a.c","-o","x"])
  subprocess.call(["./x","&lt;inp.txt"])
  </code></pre>
  
  <p>Both script ask for input though terminal. But I think in the second script it should read from file. why both the programs are working the same?</p>