title: How to redirect more than one text file in c programm
body: <p>How to redirect more than one text file in c program? For  example I have the following C code:</p>
  
  <pre><code>//redirection.c
  #include&lt;stdio.h&gt;
  main()
  {
  int x,y;
  scanf("%d",&amp;x);
  x=x*x;
  printf("%d",x);
  
  scanf("%d",&amp;y);
  y=x+y;
  printf("%d",y);
  }
  </code></pre>
  
  <p>After compiling this code I created two text files text1.txt having the value 8 and text2.txt having the value 6.</p>
  
  <p>When I give input to this program using command line redirection (as <code>redirection&lt;text1.txt</code>), it gives output 64 and does not wait to take another input (and program exits)  which I want to give another input from text2.txt.</p>
  
  <p>Is there any solution how can I send another input via text2.txt for second scanf function in the above program?</p>