title: Why are fputc and fputs outputs not immediately noticable?
body: <p>I am writing a C program, but not seeing the results of either an <code>fputc</code> or <code>fputs</code> call. I need help with understanding why that is happening.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(void)
  {
    FILE *stream;
    int file_state;
    int input1=0;
    stream = fopen("data3.txt", "w");
    if (stream == NULL)
      puts("file open error");   
    puts("input data");
    while (input1 != EOF)
      {
        input1=fgetc(stdin);
        putchar(input1);
        //fputc(input1, stdout);
        //fprintf(stream, "tee");
        //fputc('A', stream);
        //fputs("sass", stream);
      }
    file_state=fclose(stream);
    if(file_state==EOF)
      puts("file close error");
    return 0;
  }
  </code></pre>
  
  <p>Problem is that <code>fputc</code> and <code>fputs</code> do not work properly.
  I am on mac lion 64 bit, and using <code>make</code> and <code>./file_name</code> on the terminal.</p>
  
  <p>In the while loop, if I write</p>
  
  <pre><code>putchar(input1);
  </code></pre>
  
  <p>it outputs (prints) to the terminal.
  However, all of the commented lines don't work.</p>
  
  <pre><code>fputc(input1, stdout); 
  </code></pre>
  
  <p>also prints a blank line on the terminal.</p>
  
  <p>The program creates a file, yet seems to be completely empty. What could be the problem?</p>