basic_istream::getline

basic_istream::getline

basic_istream& getline(E *s, streamsize n);
basic_istream& getline(E *s, streamsize n, E delim);

The first of these unformatted input functions returns getline(s, n, widen('\n')).

The second 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. In order of testing, extraction stops:

  1. At end of file.
  2. After the function extracts an element that compares equal to delim, in which case the element is neither put back nor appended to the controlled sequence.
  3. After the function extracts is.max_size() elements.

If the function extracts no elements, it calls setstate(failbit). In any case, it returns *this.