What exactly is streambuf? How do I use it?

user541686 picture user541686 · Nov 14, 2011 · Viewed 46.9k times · Source

I'm trying to learn a bit more about how I/O streams work in C++, and I'm really confused at when to use what.

What exactly is a streambuf?
When do I use a streambuf, as compared to a string, an istream, or a vector? (I already know the last three, but not how streambuf compares to them, if it does at all.)

Answer

COD3BOY picture COD3BOY · Nov 14, 2011

With the help of streambuf, we can work in an even lower level. It allows access to the underlying buffers.

Here are some good examples : Copy, load, redirect and tee using C++ streambufs and in reference to comparison, This might be helpful,

enter image description here

See this for more details : IOstream Library