title: Process UTF-8 characters in C from a text file
body: <p>I need to read UTF-8 characters from a text file and process them.
  for instance to calculate the frequency of occurrence of a certain character. Ordinary characters are fine. The problem occurs with characters like <code>ü</code> or <code>ğ</code>.
  following is my code to check if a certain character occurs comparing the ascii code of the incoming character:</p>
  
  <pre><code>FILE * fin;
  FILE * fout;
  wchar_t c;
  fin=fopen ("input.txt","r");
  fout=fopen("out.txt","w");
  int frequency = 0;
  while((c=fgetwc(fin))!=WEOF)
  {
     if(c == SOME_NUMBER){ frequency++; }
  }
  </code></pre>
  
  <p><code>SOME_NUMBER</code> is what I can't figure out for those characters. Infact those characters print out 5 different numbers when trying to print it as a decimal.
  whereas for example for character <code>'a'</code> I would do as: <code>if(c == 97){ frequency++; }</code> since the ascii code of <code>'a'</code> is <code>97</code>.
  Is there anyway that I could identify those special characters in C?</p>
  
  <p>P.S. working with ordinary char ( not <code>wchar_t</code> ) creates the same problem, but this time printing the decimal equivalent of the incoming character would print 5 different NEGATIVE numbers for those special characters. Problem stands.</p>