title: EOF not working in while loop for getchar() in Ubuntu 11.10
body: <pre><code>#include &lt;stdio.h&gt;
  #ifndef EOF
  #define EOF (-1)
  #endif
  
  int main(void)
  {
      int nb, nl, nt, c;
      nb = 0;
      nl = 0;
      nt = 0;
      while ((c = getchar()) != EOF){
          if (c == ' ')
              ++nb;
          else if (c == '\n')
              ++nl;
          else if (c == '\t')
              ++nt;
      }
      printf("Input has %d blanks, %d tabs, and %d newlines\n", nb, nt, nl);
      return 0;
  }
  </code></pre>
  
  <p>Why is this code not working?</p>
  
  <p>I compiled this code on my Ubuntu 11.10. If I replace <code>EOF</code> with <code>\n</code>, it's working as expected, but not with EOF.</p>