So I am using file stream to see in a file. Then read the contents of the file. I am supposed to be counting the number of words, sentences, digits etc. I am working on the digit count right now and this is not working! It should work- unless I am seeing something small that I dont have. Please someone help me! Heres the code:

Code:
int numdigits(ifstream& name)
{
  string words;
  char ch;
  int count = 0;

 name >> words;
 while(!name.eof())
   {
     name >> ch;
    if (ch == 1)
       {
      count ++;
       }
    name >> words;
   }
  return count;
}
Iwant it to count the number of digits in the file. Thanks!