單個字元 (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 | 函式停止提取字元,因為輸入序列沒有更多可用字元(已到達 檔案末尾)。 |
failbit | Either no characters were written or an empty c-string was stored in s. |
badbit | 流錯誤(例如,當此函式捕獲由內部操作丟擲的異常時)。 When set, the integrity of the stream may have been affected. |
|
|