Next: , Previous: , Up: ostream subclasses without styling   [Contents][Index]


3.5.3.5 The memory_ostream class

The memory_ostream class supports output to an in-memory buffer. Its type is ‘memory_ostream_t’. It is a subclass of ‘ostream_t’.

It can be instantiated through this function:

Function: memory_ostream_t memory_ostream_create (void)

Creates an output stream that accumulates the output in a memory buffer.

The class adds the following method:

Function: void memory_ostream_contents (memory_ostream_t stream, const void **bufp, size_t *buflenp)

Returns a pointer to the output accumulated so far and its size. It stores them in *bufp and *buflenp, respectively.

Note: These two return values become invalid when more output is done to the stream or when the stream is freed.