The extraction ends when n characters have been extracted and discarded or when the character delim is found, whichever comes first. In the latter case, the delim character itself is also extracted.
Parameters
- n
- Maximum number of characters to extract (and ignore).
This is an integer value of type streamsize. - delim
- Delimiting character.
Return Value
The function returns *this.Errors are signaled by modifying the internal state flags:
| flag | error |
|---|---|
| eofbit | The end of the source of characters is reached during its operations. |
| failbit | - |
| badbit | An error other than the above happened. |
Additionally, in any of these cases, if the appropriate flag has been set with member function ios::exceptions, an exception of type ios_base::failure is thrown.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
This example ilustrates how after reading the first character with get, the remaining input characters up to the next whitespace character are ignored.
Basic template member declarations
( basic_istream<charT,traits> )| 1 2 |
|
See also
| istream::peek | Peek next character (public member function) |
| istream::get | Get unformatted data from stream (public member function) |
| istream::getline | Get line from stream (public member function) |
| istream::read | Read block of data (public member function) |
| istream::readsome | Read block of data available in the buffer (public member function) |
