ends function template — Manipulator to write an end-of-string character
template <class charT, class traits>
basic_ostream<charT,traits>& ends(basic_ostream<charT,traits>& os);
The ends
function template
is a manipulator that writes a null character (defined by charT( )
) to os
to mark the end of a string. Typically,
ends
is used only when writing to
a character array stream, that is, ostrstream
:
std::ostrstream out1; out1 << "Hi" << std::ends; // out1.str( ) has length 2.