title: C - change stdin and wait for user input
body: <p>I have the following code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
     char c = 0;
     fclose(stdin);
     stdin = fopen("newin", "r");
     if(stdin != NULLL)
     {
        scanf("%c", &amp;c);
        printf("%d", c);
     }
     else
         printf("Error");
  }
  </code></pre>
  
  <p>I want my program to wait for a change in the stdin file. I created it blank, but it returns 0. </p>
  
  <p>If a put like a 'a' char in it it prints 97 like it should.</p>
  
  <p>How can I make the scanf wait for a change in the file, like it was waiting for me to write in the terminal window?</p>