Returns the number of characters extracted by the last unformatted input operation, or the maximum representable value of std::streamsize if the number is not representable.
The following member functions of basic_istream
change the value of subsequent gcount()
calls:
The following functions set gcount()
to zero:
(none)
[edit] Return valueThe number of characters extracted by the last unformatted input operation, or the maximum representable value of std::streamsize if the number is not representable.
[edit] Example#include <iostream> #include <sstream> int main() { char x[20]; std::istringstream stream("Hello World"); stream.read(x, sizeof x); std::cout << "Characters extracted: " << stream.gcount(); }
Output:
[edit] Defect reportsThe following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior LWG 3464 C++98 the return value was unspecified when the result overflows returns the maximum valueRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4