title: Counting words in a file using only stdio.h and stdlib.h
body: <p>I need to count the number of <strong>WORD/CHARACTERS</strong> <em>&quot;ananas&quot;</em>  in some <strong>FILE</strong>.</p>
  <p>I need to <strong>rewrite</strong> this file with the number of words &quot;ananas&quot;.</p>
  <ul>
  <li>Also I can use only these 4 functions!!!! <em>fopen(), fclose(), fgetc(), fputc()</em></li>
  <li>It should be count Big Capitals characters as Smaller characters too (e.g. aNaNAs)</li>
  </ul>
  <p><strong>Example</strong></p>
  <p>Input file: <em>Bananas are edible fruits, botanically berries. I love BANANAS because they are really good aNanas.</em></p>
  <p>Output file: <em>3</em></p>
  <p>My code:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  
  int main(){
      char filename[20];
      char ch;
    FILE *fp = fopen(filename,&quot;r&quot;);
      if (fp == NULL)
      {
          perror(&quot;Error opening file.&quot;);//perror=printf pre errory
          return 1;
      }
   
      /* Normal processing continues here. */
     
      while((ch = fgetc(fp)) != EOF){
        
      }
      fclose(fp);
      return EXIT_SUCCESS;
  
  
  }
  
  </code></pre>