Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::ifstream inFile("file");
- std::count(std::istreambuf_iterator<char>(inFile),
- std::istreambuf_iterator<char>(), 'n');
- int numLines = 0;
- ifstream in("file.txt");
- std::string unused;
- while ( std::getline(in, unused) )
- ++numLines;
- int numLines = 0;
- ifstream in("file.txt");
- //while ( ! in.eof() )
- while ( in.good() )
- {
- std::string line;
- std::getline(in, line);
- ++numLines;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement