This is an example of how to implement a streambuffer to manipulate the data in the stream. The application is explained in this article in Spanish "Implementar nuestro propio stream en C++".
# create build folder
mkdir build
# move to the folder
cd build
# build the project
cmake ..
# execute ecample
./stream_example
# execute tests
ctest
Note: cmake is needed for build the project