Could be the way you're analyzing the ret val of scanf. Don't use the function much myself. I did notice some inconsitencies with the code though. The function doesn't return anything - how useful is that? You shouldn't really be printing from within the function either since if you ever do reuse it, you'll always get a printout - extra baggage so to speak. Finally, since the function operates on an already open file, it should go back to where it started whenever the function completes. Here's a more robust approach. This function will count any given character, thus eeking out as much reusability as possible (the primary aim of a software engineer of course).
Code:
unsigned int count_char(FILE * inFile, char what)
{
int ch;
unsigned int count = 0;
unsigned int bookmark = ftell(inFile); // save the current position
while ((ch = fgetc(inFile)) != EOF)
if (ch == what)
count++;
fseek(inFile, bookmark, SEEK_SET); // restore file-position
return count;
}