if the file you are reading only contains strings and numbers then u can easily do it...(i.e. there are no alphanumeric words in the file)

in this case
1) read every word from the file as a string ...
2) convert the string into a number using atof
3) if the input is a string the return value of the function atof is 0 otherwise the return value will be
the number converted.
4) put a check in your program for the return value of the function and you are done