std::basic_istream::get
From Cppreference
C++ Standard Library | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Input/output library | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::basic_istream | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
int get();
|
(1) | |
basic_istream& get( char_type& ch );
|
(2) | |
basic_istream& get( char_type* s, pos_type count );
|
(3) | |
basic_istream& get( char_type* s, pos_type count, char delim );
|
(4) | |
basic_istream& get( basic_streambuf& strbuf );
|
(5) | |
basic_istream& get( basic_streambuf& strbuf, char delim );
|
(6) | |
Extracts characters from stream. For all versions if good() != true, setstate(failbit) is called and the function returns. If end-of-file occurs, setstate(eofbit) is called and the function returns.
1) reads one character and returns it.
2) reads one character and stores it to ch.
3) reads at most count-1 characters and stores them into character string pointed to by s. The function stops if \n delimiting character is found, in which case it is extracted but not stored. The resulting string is always null-terminated.
4) reads at most count-1 characters and stores them into character string pointed to by s. The function stops if delim delimiting character is found, in which case it is neither extracted nor stored. The resulting string is always null-terminated.
5) reads characters and inserts them to the given basic_streambuf object. The function stops if \n delimiting character is found, in which case it is neither extracted nor stored.
6) reads characters and inserts them to the given basic_streambuf object. The function stops if delim delimiting character is found, in which case it is extracted but not stored.
Contents |
[edit] Parameters
ch | - | reference to the character to write the result to |
s | - | pointer to the character string to store the characters to |
count | - | size of character string pointed to by s |
delim | - | delimiting character to stop the extraction at. It is extracted but not stored. |
strbuf | - | stream buffer to read the content to |
[edit] Return value
1) the extracted character
2-6) *this
[edit] Example
This section is incomplete |
[edit] See also
|
extracts blocks of characters (public member function) |
|
|
extracts formatted data (public member function) |