Name
ends function template — Manipulator to write an end-of-string character
Synopsis
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.
See Also
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.