Whether it's a text file or a binary file gcount() always returning 0 but int size gets the values read.
Why?
Code:int size; string str; ifstream ifs; ifs.open(file, ifstream::binary); while(!ifs.eof()) { getline(ifs, str); cout << ifs.gcount() << " characters read: " << '\n'; size = str.size(); cout << "size " << size << endl; }