Search code examples
c++istream

Checking count of bytes read by istream::read()


Is there posibility (any method) to check count of bytes read by function presented below:

istream& read (char* s, streamsize n);

Solution

  • std::streamsize gcount() const;
    

    Returns the number of characters extracted by the last unformatted input operation.

    gcount