single character (1) | int get();istream& get (char& c); |
---|---|
c-string (2) | istream& get (char* s, streamsize n);istream& get (char* s, streamsize n, char delim); |
stream buffer (3) | istream& get (streambuf& sb);istream& get (streambuf& sb, char delim); |
(n-1)
characters have been extracted or the delimiting character is encountered: the delimiting character being either the newline character ('\n'
) or delim (if this argument is specified).'\0'
) is automatically appended to the written sequence if n is greater than zero, even if an empty string is extracted.'\n'
, or delim, if this argument is specified).true
). Then (if good), it extracts characters from its associated stream buffer object as if calling its member functions sbumpc or sgetc, and finally destroys the sentry object before returning.2
, the function does not extract any characters and sets failbit.EOF
) if no characters are available in the stream (note that in this case, the failbit flag is also set).*this
. Note that this return value can be checked for the state of the stream (see casting a stream to bool for more info).flag | error |
---|---|
eofbit | The function stopped extracting characters because the input sequence has no more characters available (end-of-file reached). |
failbit | Either no characters were written or an empty c-string was stored in s. |
badbit | Error on stream (such as when this function catches an exception thrown by an internal operation). When set, the integrity of the stream may have been affected. |
|
|