#include #include #include #include #define NOFCHANNELS 5 int fly(const char *fname = "trial_3.txt") { int npoints = 0; float entries[(NOFCHANNELS)]; std::string line; std::ifstream ifs(fname); while(1) { getline(ifs, line); if ( ! ifs.good() ) break; #if 0 /* 0 or 1 */ std:: cout << "line = " << line << std::endl; #endif /* 0 or 1 */ for(int i = 0; i < (NOFCHANNELS); i++) entries[i] = 0.0; sscanf(line.c_str(), "%f %f %f %f %f", &entries[0], &entries[1], &entries[2], &entries[3], &entries[4]); #if 0 /* 0 or 1 */ std:: cout << "entries[] = "; for(int i = 0; i < (NOFCHANNELS); i++) std:: cout << entries[i] << " "; std:: cout << std::endl; #endif /* 0 or 1 */ npoints++; } #if 0 /* 0 or 1 */ std::cout << "npoints = " << npoints << std::endl; #endif /* 0 or 1 */ return npoints; }