| 48 | } |
| 49 | |
| 50 | int TextFileReader::Count() { |
| 51 | std::ifstream fin(path_, std::ios::in); |
| 52 | CHECK(fin.is_open()) << "Cannot create file " << path_; |
| 53 | int count = 0; |
| 54 | string line; |
| 55 | while (!fin.eof()) { |
| 56 | std::getline(fin, line); |
| 57 | if (line != "") count++; |
| 58 | } |
| 59 | fin.close(); |
| 60 | return count; |
| 61 | } |
| 62 | |
| 63 | void TextFileReader::SeekToFirst() { |
| 64 | CHECK(fdat_.is_open()); |