std::basic_filebuf::pbackfail

From cppreference.com
protected:
virtual int_type pbackfail( int_type c = Traits::eof() )

Puts the character c back into the get area, in one of the three ways:

1) If c is not the EOF character, as determined by calling Traits::eq_int_type(c,traits::eof()) and if there is room for a putback, and if c is exactly the character that was most recently read from the get area, as determined by Traits::eq(to_char_type(c),gptr()[-1]), then simply decrements gptr() by one.

2) If c is not the EOF character, as determined by calling Traits::eq_int_type(c,traits::eof()) and if there is room for a putback, and if the buffer is allowed to modify the get area, decrements gptr() and writes c to there. Note that this does not modify the associated character sequence (the file), but only the get area in memory.

3) If c is the EOF character (Traits::eq_int_type(c,traits::eof()) returns true), and if there is room for a putback, decrements gptr(). This has the effect of making the last character read available for reading once again.

If the file is not open (is_open()==false, this function returns Traits::eof() immediately.

Contents

[edit] Parameters

c - the character to putback, or eof

[edit] Return value

1-2) c

3) Traits::not_eof(c)

Traits::eof() in case of failure.

[edit] Example

[edit] See also

[virtual]
puts a character back into the input sequence, possibly modifying the input sequence
(virtual protected member function of std::basic_streambuf)
moves the next pointer in the input sequence back by one
(public member function of std::basic_streambuf)
puts one character back in the input sequence
(public member function of std::basic_streambuf)
unextracts a character
(public member function of std::basic_istream)
puts character into input stream
(public member function of std::basic_istream)