In the previous section, you saw how the virtual streams facility abstracts the formatting of items inserted into the stream. The disposition of the items inserted into the streams has also been made abstract: it is set by the type of streambuf used.
Class streambuf is the underlying sequencing layer of the iostreams facility. It is responsible for producing and consuming sequences of characters. Your compiler comes with several versions. For example, class filebuf ultimately gets and puts its characters to a file. Class strstreambuf gets and puts to memory-based character streams; you can think of it as the iostream equivalent to ANSI-C's sprintf() function. Now Tools.h++ adds two Windows-based extensions:
Class RWCLIPstreambuf for getting and putting to the Windows Clipboard;
Class RWDDEstreambuf for getting and putting through the Windows Dynamic Data Exchange (DDE) facility.
These classes take care of the details of allocating and reallocating memory from Windows as buffers overflow and underflow. In the case of class RWDDEstreambuf, the associated DDEDATA header is also filled in for you. Any class that inherits from class ios can be used with these streambufs, including the familiar istream and ostream, as well as the Rogue Wave virtual stream classes.
The result is that the same code that is used to store a complex structure to a conventional disk-based file, for example, can also be used to transfer that structure through the DDE facility to another application!