GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::basic_istream::gcount(3) C++ Standard Libary std::basic_istream::gcount(3)

std::basic_istream::gcount - std::basic_istream::gcount


std::streamsize gcount() const;


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:


* move constructor
* swap()
* get()
* getline()
* ignore()
* read()
* readsome()
* operator>>(basic_streambuf*)


The following functions set gcount() to zero:


* constructor
* putback()
* unget()
* peek()


(none)


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.

// Run this code


#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();
}


Characters extracted: 11


Defect reports


The 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 returns the maximum
result overflows value

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.