It is used to put character back and moves back the get pointer (gptr) one position to point to the previous character and, if the basic_stringbuf object was constructed with ios_base::out, it stores c at that position.
Following is the declaration for std::basic_stringbuf::pbackfail.
int_type pbackfail (int_type c = traits_type::eof());
cCharacter to be put back.
It returns traits_type::not_eof(c) on success or the end-of-file value on failure.
Basic guarantee − if an exception is thrown, the object is in a valid state.
It modifies the basic_stringbuf object.