title: How can I redefine stdin to point to the console after using file redirection in Unix?
body: <p>I am working in Unix and I am supposed to first read in text through redirection and then ask the user to enter in a specific character and count how many times it is in the character array.</p>
  
  <pre><code>const int MAX = 8000;
  int input = 1;
  int i = 0;
  char text[MAX], letter;
  while(input != 0)
  {
      scanf("%c", &amp;text[i]);
      if(text[i] == '0')
          input = 0;
      i++;
  }
  printf("\n%s",text);
  
  printf("\nEnter a letter to search for in the text: ");
  scanf("%c", &amp;letter)
  </code></pre>
  
  <p>Currently, I am printing the correct file through redirection, however my second <code>scanf</code> is being skipped.  I am redirecting the file using the command: <code>./a.out &lt; filename.txt</code>.</p>
  
  <p>If I try and print the character <code>letter</code> then it will result in nothing. It must be reading the <code>\n</code> from inside the empty lines of the text file still.  How do I stop the <code>scanf</code> from reading the same text file and let me enter a letter from my keyboard in the console? As an assignment I HAVE to use the command <code>./a.out &lt; filename.txt</code>.</p>