Can someone write some sample code to explain this concept? I know what a buffered stream is used for, but I also would like to know how to implement that.
Thanks in advance!
You can look into your platform's implementation, the C++ standard or "Standard C++ IOstreams and Locales" by Angelika Langer and Klaus Kreft.
Be prepared for quite a learning curve. Streams are old and a complicated matter. (Francis Glassborow: "I have very few doubts that I/O libraries are amongst the most difficult aspects of any language.")