std::basic_ostream<CharT,Traits>::tellp (3) - Linux Manuals
std::basic_ostream<CharT,Traits>::tellp: std::basic_ostream<CharT,Traits>::tellp
Command to display std::basic_ostream<CharT,Traits>::tellp
manual in Linux: $ man 3 std::basic_ostream<CharT,Traits>::tellp
NAME
std::basic_ostream<CharT,Traits>::tellp - std::basic_ostream<CharT,Traits>::tellp
Synopsis
pos_type tellp();
Returns the output position indicator of the current associated streambuf object.
Behaves as UnformattedOutputFunction (except without actually performing output). After constructing and checking the sentry object, (since C++11)
If fail()==true, returns pos_type(-1). Otherwise, returns rdbuf()->pubseekoff(0, std::ios_base::cur, std::ios_base::out).
Parameters
(none)
Return value
current output position indicator on success, pos_type(-1) if a failure occurs.
Example
// Run this code
#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:
0
1
13
18
hello, world 3.14
See also
sets the output position indicator
seekp (public member function)
returns the input position indicator
tellg (public member function of std::basic_istream<CharT,Traits>)
sets the input position indicator
seekg (public member function of std::basic_istream<CharT,Traits>)
Pages related to std::basic_ostream<CharT,Traits>::tellp
- std::basic_ostream<CharT,Traits>::basic_ostream (3) - std::basic_ostream<CharT,Traits>::basic_ostream
- std::basic_ostream<CharT,Traits>::flush (3) - std::basic_ostream<CharT,Traits>::flush
- std::basic_ostream<CharT,Traits>::operator<< (3) - std::basic_ostream<CharT,Traits>::operator<<
- std::basic_ostream<CharT,Traits>::operator= (3) - std::basic_ostream<CharT,Traits>::operator=
- std::basic_ostream<CharT,Traits>::put (3) - std::basic_ostream<CharT,Traits>::put
- std::basic_ostream<CharT,Traits>::seekp (3) - std::basic_ostream<CharT,Traits>::seekp
- std::basic_ostream<CharT,Traits>::sentry (3) - std::basic_ostream<CharT,Traits>::sentry
- std::basic_ostream<CharT,Traits>::swap (3) - std::basic_ostream<CharT,Traits>::swap
- std::basic_ostream<CharT,Traits>::write (3) - std::basic_ostream<CharT,Traits>::write
- std::basic_ostream<CharT,Traits>::~basic_ostream (3) - std::basic_ostream<CharT,Traits>::~basic_ostream
- std::basic_ostream (3) - std::basic_ostream
- std::basic_ostream_sentry (3)
- std::basic_ostringstream (3) - std::basic_ostringstream
- std::basic_ostringstream::operator= (3) - std::basic_ostringstream::operator=
- std::basic_ostringstream::rdbuf (3) - std::basic_ostringstream::rdbuf
- std::basic_ostringstream::swap (3) - std::basic_ostringstream::swap
- std::basic_ostringstream<CharT,Traits,Allocator>::basic_ostringstream (3) - std::basic_ostringstream<CharT,Traits,Allocator>::basic_ostringstream
- std::basic_ostringstream<CharT,Traits,Allocator>::str (3) - std::basic_ostringstream<CharT,Traits,Allocator>::str
- std::basic_osyncstream (3) - std::basic_osyncstream