| I/O manipulators | ||||
| Print functions(C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++20) | ||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
| Synchronized Output | ||||
(C++20) | ||||
| Types | ||||
| Error category interface | ||||
(C++11) | ||||
(C++11) |
| Global objects | ||||
| Member functions | ||||
(C++11) | ||||
| Formatted output | ||||
| Unformatted output | ||||
| Positioning | ||||
basic_ostream::tellp | ||||
| Miscellaneous | ||||
(C++11) | ||||
| Member classes | ||||
| Non-member functions | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
pos_type tellp(); | ||
Returns the output position indicator of the current associatedstreambuf object.
Behaves asUnformattedOutputFunction (except without actually performing output). After constructing and checking the sentry object, | (since C++11) |
Iffail()==true, returnspos_type(-1). Otherwise, returnsrdbuf()->pubseekoff(0,std::ios_base::cur,std::ios_base::out).
Contents |
(none)
current output position indicator on success,pos_type(-1) if a failure occurs.
#include <iostream>#include <sstream>int main(){std::ostringstream s;std::cout<< s.tellp()<<'\n'; s<<'h';std::cout<< s.tellp()<<'\n'; s<<"ello, world ";std::cout<< s.tellp()<<'\n'; s<<3.14<<'\n';std::cout<< s.tellp()<<'\n'<< s.str();}
Output:
011318hello, world 3.14
| sets the output position indicator (public member function)[edit] | |
| returns the input position indicator (public member function of std::basic_istream<CharT,Traits>)[edit] | |
| sets the input position indicator (public member function of std::basic_istream<CharT,Traits>)[edit] |