[streambuf.virt.pback] # 31 Input/output library [[input.output]](./#input.output) ## 31.6 Stream buffers [[stream.buffers]](stream.buffers#streambuf.virt.pback) ### 31.6.3 Class template basic_streambuf [[streambuf]](streambuf#virt.pback) #### 31.6.3.5 Virtual functions [[streambuf.virtuals]](streambuf.virtuals#streambuf.virt.pback) #### 31.6.3.5.4 Putback [streambuf.virt.pback] [🔗](#lib:pbackfail,basic_streambuf) `int_type pbackfail(int_type c = traits::eof()); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3931) The[*pending sequence*](#def:pending_sequence) is defined as forunderflow(), with the modifications that - [(1.1)](#1.1) Iftraits​::​eq_int_type(c, traits​::​eof()) returnstrue, then the input sequence is backed up one character before the pending sequence is determined[.](#1.1.sentence-1) - [(1.2)](#1.2) Iftraits​::​eq_int_type(c, traits​::​eof()) returns false, then c is prepended[.](#1.2.sentence-1) Whether the input sequence is backed up or modified in any other way is unspecified[.](#1.2.sentence-2) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3951) *Postconditions*: On return, the constraints ofgptr(),eback(), andpptr() are the same as forunderflow()[.](#2.sentence-1) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3961) *Returns*: traits​::​eof() to indicate failure[.](#3.sentence-1) Failure may occur because the input sequence could not be backed up, or if for some other reason the pointers cannot be set consistent with the constraints[.](#3.sentence-2) pbackfail() is called only when put back has really failed[.](#3.sentence-3) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3970) Returns some value other thantraits​::​eof() to indicate success[.](#4.sentence-1) [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3975) *Default behavior*: Returnstraits​::​eof()[.](#5.sentence-1) [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3980) *Remarks*: The public functions ofbasic_streambuf call this virtual function only whengptr() is null,gptr() == eback(), ortraits​::​eq(traits​::​to_char_type(c), gptr()[-1]) returnsfalse[.](#6.sentence-1) Other calls shall also satisfy that constraint[.](#6.sentence-2)