CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Sat, 26 Jul 2025 07:53:08 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/sstream/basic_stringbuf/pbackfail/
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 26 Jul 2025 07:53:09 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"71e9-ZV2lQLi4xzwtKWOIj1ytOkAZObE"
Content-Encoding: gzip
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.
If the basic_stringbuf object was not constructed with ios_base::out, c shall either match the character at the putback position or be the end-of-file value (
If the get pointer is already at the beginning of the character sequence before the call, the function also fails.
On failure, the function returns the end-of-file value (
This virtual function is called by public member functions of basic_streambuf such as sungetc and sputbackc when there are no putback positions available at the get pointer (gptr), or when the character being put back does not match the one in the buffer.
The function returns the end-of-file value (
Member type int_type is an integral type able to represent any character value or the special end-of-file value.
Concurrent access to the same object may cause data races.
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
-
<cfenv> (fenv.h)C++11
- <cfloat> (float.h)
-
<cinttypes> (inttypes.h)C++11
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
-
<cstdbool> (stdbool.h)C++11
- <cstddef> (stddef.h)
-
<cstdint> (stdint.h)C++11
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
-
<ctgmath> (tgmath.h)C++11
- <ctime> (time.h)
-
<cuchar> (uchar.h)C++11
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
-
<array>C++11
- <deque>
-
<forward_list>C++11
- <list>
- <map>
- <queue>
- <set>
- <stack>
-
<unordered_map>C++11
-
<unordered_set>C++11
- <vector>
-
Input/Output:
Multi-threading:
-
<atomic>C++11
-
<condition_variable>C++11
-
<future>C++11
-
<mutex>C++11
-
<thread>C++11
-
Other:
- <algorithm>
- <bitset>
-
<chrono>C++11
-
<codecvt>C++11
- <complex>
- <exception>
- <functional>
-
<initializer_list>C++11
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
-
<random>C++11
-
<ratio>C++11
-
<regex>C++11
- <stdexcept>
- <string>
-
<system_error>C++11
-
<tuple>C++11
-
<type_traits>C++11
-
<typeindex>C++11
- <typeinfo>
- <utility>
- <valarray>
- Reference
- <sstream>
- basic_stringbuf
- pbackfail
protected virtual member function
<sstream>
std::basic_stringbuf::pbackfail
int_type pbackfail (int_type c = traits_type::eof());
Put character back
If the basic_stringbuf object was not constructed with ios_base::out, c shall either match the character at the putback position or be the end-of-file value (
traits_type::eof()
). Otherwise, the function fails. The function uses traits_type::eq for the comparisons, with c converted with traits_type::to_char_type when needed.If the get pointer is already at the beginning of the character sequence before the call, the function also fails.
On failure, the function returns the end-of-file value (
traits_type::eof()
) without altering the get pointer (gptr).This virtual function is called by public member functions of basic_streambuf such as sungetc and sputbackc when there are no putback positions available at the get pointer (gptr), or when the character being put back does not match the one in the buffer.
Parameters
- c
- Character to be put back, or the end-of-file value (
traits_type::eof()
) to keep the value of the character at the putback position.
Member type int_type is an integral type able to represent any character value or the special end-of-file value.
Return Value
On success,traits_type::not_eof(c)
.The function returns the end-of-file value (
traits_type::eof()
) on failure.Member type int_type is an integral type able to represent any character value or the special end-of-file value.
Data races
Modifies the basic_stringbuf object.Concurrent access to the same object may cause data races.
Exception safety
Basic guarantee: if an exception is thrown, the object is in a valid state.See also
- basic_stringbuf::underflow
- Get character (protected virtual member function)
- basic_streambuf::pbackfail
- Put character back on underflow (protected virtual member function)
Home page | Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us