single character (1) | int_type get();basic_istream& get (char_type& c); |
---|---|
c-string (2) | basic_istream& get (char_type* s, streamsize n);basic_istream& get (char_type* s, streamsize n, char_type delim); |
stream buffer (3) | basic_istream& get (basic_streambuf<char_type,traits_type>& sb);basic_istream& get (basic_streambuf<char_type,traits_type>& sb, char_type delim); |
(n-1)
characters have been extracted or the delimiting character is encountered: the delimiting character being either the newline character (widen('\n')
) or delim (if this argument is specified).char_type()
) is automatically appended to the written sequence if n is greater than zero, even if an empty string is extracted.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.traits_type::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. |
|
|