123456789
#include <string> #include <sstream> bool is_integer( const std::string& str ) { std::istringstream stm(str) ; long long test ; return stm >> test && stm.eof() ; }
12345678
int count = 0; char buff[1024]; while(fgets(buff, 1024, fp)) { double Vals; count += (sscanf(buff, "%f ", &Vals) + sscanf(buff, "%f\n", &Vals)); }
12345
int count = 0; double Vals; while(fscanf(fp, "%f ", &Vals) || fscanf(fp, "%f\n", &Vals)) count++;