I'm finding that gcount on an ifstream object after a call to
getline(istream &, string &)
returns 0.
Is this supposed to be the case?
I'm finding that gcount on an ifstream object after a call to
getline(istream &, string &)
returns 0.
Is this supposed to be the case?
Yes, gcount()
is supposed to return the number of characters extracted by the last unformatted input operation performed on the object.
getline()
is listed in the functions supposed to updated gcount()
, but it is the member getline()
of a stream and not the string getline()
.
In case of doubt, this link tells it black on white: Behaves as UnformattedInputFunction, except that input.gcount() is not affected.
© 2022 - 2024 — McMap. All rights reserved.