Share via


basic_istream::get

basic_istream::get

int_type get();
basic_istream& get(E& c);
basic_istream& get(E *s, streamsize n);
basic_istream& get(E *s, streamsize n, E delim);
basic_istream& get(basic_streambuf<E, T> *sb);
basic_istream& get(basic_streambuf<E, T> *sb, E delim);

The first of these unformatted input functions extracts an element, if possible, as if by returning rdbuf()->sbumpc(). Otherwise, it returns T::eof(). If the function extracts no element, it calls setstate(failbit).

The second function extracts the int_type element x the same way. If x compares equal to T::eof(x), the function calls setstate(failbit). Otherwise, it stores T::to_char_type(x) in c. The function returns *this.

The third function returns get(s, n, widen('\n')).

The fourth function extracts up to n - 1 elements and stores them in the array beginning at s. It always stores E(0) after any extracted elements it stores. Extraction stops early on end-of-file or on an element that compares equal to delim (which is not extracted). If the function extracts no elements, it calls setstate(failbit). In any case, it returns *this.

The fifth function returns get(sb, widen('\n')).

The sixth function extracts elements and inserts them into sb. Extraction stops on end-of-file or on an element that compares equal to delim (which is not extracted). It also stops, without extracting the element in question, if an insertion fails or throws an exception (which is caught but not rethrown). If the function extracts no elements, it calls setstate(failbit). In any case, the function returns *this.