cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : IOstream Library : stringbuf : pbackfail
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
IOstream Library
manipulators
classes:
· filebuf
· fstream
· ifstream
· ios
· iostream
· ios_base
· istream
· istringstream
· ofstream
· ostream
· ostringstream
· streambuf
· stringbuf
· stringstream
objects:
· cerr
· cin
· clog
· cout
types:
· fpos
· streamoff
· streampos
· streamsize
stringbuf
· stringbuf::stringbuf
public members:
· stringbuf::str
virtual members:
· stringbuf::overflow
· stringbuf::pbackfail
· stringbuf::seekoff
· stringbuf::seekpos
· stringbuf::setbuf
· stringbuf::underflow

-

stringbuf::pbackfail virtual protected member function
int pbackfail ( int c = EOF );

Put character back

If the parameter c is EOF and the get pointer is not at the beginning of the character sequence, the get pointer is decreased by one.

If the parameter c is value other than EOF and the get pointer is not at the beginning of the character sequence, the function compares c to the character right before the current position.

If they match, the get pointer is decreased by one. If they do not match, the behavior depends on whether the stringbuf object was constructed with output access or not (with ios_base::out in its openmode parameter or not). If it was constructed with output access, c replaces the character right before the current position and the get pointer is decreased by one.

In all other cases, the get pointer is not modified and the function returns EOF (or traits::eof() for other traits) to signal failure.

This member function overrides the virtual member streambuf::pbackfail, which is called by other member functions of streambuf.

Parameters

c
Character to be put back, or EOF (or traits::eof() for other traits) to keep the existing character at that position.

Return Value

The function returns EOF (or traits::eof() for other traits) in none of the conditions above were met and therefore the get pointer was not modified.

A value different from EOF (or traits::eof() for other traits) is returned if one the conditions above were met and therefor the function was successful in decreasing the get pointer. If c was specified, the value returned is c.

Basic template member declaration

( basic_stringbuf<charT,traits,Allocator> )
typedef traits::int_type int_type;
int_type pbackfail ( int_type c = traits::eof() );

See also

stringbuf::underflow Get character (virtual protected member function)

© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us