std::basic_ostream<CharT,Traits>::tellp

Returns the output position indicator of the current associated streambuf object.

# Declarations

pos_type tellp();

# Return value

current output position indicator on success, pos_type(-1) if a failure occurs.

# Example

#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();
}

# See also