counting characters (again!)
<p>Suppose I would like to count characters in some <code>mFile</code> like this:</p>

<pre><code>  while((c = getc(mFile)) != EOF){
    chars[c]++;
  }
</code></pre>

<p>If I try to show them:</p>

<pre><code>  for(int f=0;f&lt;256;f++) {
    if(isprint(f) &amp;&amp; chars[f]&gt;0) 
      cout &lt;&lt; (char)f &lt;&lt; " " &lt;&lt; (int)chars[f] &lt;&lt; endl;
  }
</code></pre>

<p>All characters print fine. But if I do</p>

<pre><code>      cout &lt;&lt; " " &lt;&lt; (int)chars[32] &lt;&lt; endl;
</code></pre>

<p>Then it doesn't print the number... just some large <code>int</code>, I guess, because it's negative. What am I doing wrong? Does <code>getc</code> break on, or not count spaces?</p>

<p>Thanks</p>
