title: Signal EOF in mac osx terminal
body: <p>I am stumped by the 1.5.2 question in K&amp;R. I googled for sometime and found out that I have to supply the EOF input after entering the characters.</p>
  <pre><code>long nc = 0;
  
  while (getchar() != EOF)
      ++nc;
  printf(&quot;%ld\n&quot;, nc);
  
  return 0;
  </code></pre>
  <p>I tried both command-D and control-D as EOF inputs but nothing worked. Any idea how to supply the EOF for Mac OS X?</p>