skip to content
Ivan's wiki
Site Tools
Search
Tools
Show pagesource
Backlinks
Recent Changes
Media Manager
Sitemap
>
Recent Changes
Media Manager
Sitemap
hpp-streambuf
This page is read only. You can view the source, but not change it.
# <streambuf> **[<streambuf>](https://en.cppreference.com/w/cpp/header/streambuf)** provides `std::basic_streambuf`, the base class for stream buffers. You rarely derive from this unless you're implementing custom input or output streams. Most code just uses the derived classes provided by `<fstream>`, `<sstream>`, etc. It handles buffering, gets/puts, and low-level I/O operations. This example accesses the underlying buffer of a string stream and checks its available input. ```cpp // compile: g++ -std=c++11 -o streambufexample streambufexample.cpp // run: ./streambufexample // description: access stream buffer directly #include <streambuf> #include <iostream> #include <sstream> int main() { std::stringstream ss; ss << "hello world"; std::streambuf* buf = ss.rdbuf(); std::cout << "buffer size hint: " << buf->in_avail() << "\n"; return 0; } ```
Page Tools
Show pagesource
Backlinks
Back to top