title: Redirection from files using operator < in C
body: <p>I wrote a program that simulate the <code>bash</code> command in Linux, in C. 
  It works perfectly with inputs from the <strong>keyboard</strong>, meaning: </p>
  
  <ul>
  <li><code>application &gt; file</code>: redirect stdout of app to file(write output to file)</li>
  <li><code>application &lt; file</code>: redirect stdin of app from file (read input from file)</li>
  <li><code>application  &gt;&gt; file</code>: redirect stdout of app to file (append output to file)</li>
  <li><code>app1 | app2</code>: redirect stdout of app1 to stdin of app2</li>
  <li><code>app &amp;</code>: means that app should be executed in the background</li>
  </ul>
  
  <p>All these work, when I enter the command from the keyboard, as mentioned above.</p>
  
  <p>In order to complete my assignment, I need to add one more element, which is 
  redirection from a file. Meaning, if my program is called <code>bashSimulator</code>, then 
  if I do this:</p>
  
  <pre><code>bashSimulator &lt; fileWithCommands
  </code></pre>
  
  <p>then my program needs to get all the commands from the <code>fileWithCommands</code>  and execute them. </p>
  
  <p>I have no idea how to do the redirection from a file.</p>