Skip to content

Instantly share code, notes, and snippets.

@addam
addam / streambuf.cpp
Created May 31, 2018 20:00
Minimalist std::streambuf subclass for custom reading
#include <sstream>
#include <fstream>
#include <iostream>
#include <array>
class Buffer : public std::streambuf {
// we use ifstream here only for the sake of example
std::ifstream file;
std::array<char, 1024> data;