The following code example is taken from the book
The C++ Standard Library - A Tutorial and Reference
by Nicolai M. Josuttis, Addison-Wesley, 1999
© Copyright Nicolai M. Josuttis 1999
#include <iostream>
#include "outbuf1x.hpp"
int main()
{
outbuf ob; // create special output buffer
std::ostream out(&ob); // initialize output stream with that output buffer
out << "31 hexadecimal: " << std::hex << 31 << std::endl;
}