fork download
  1. #include <fstream>
  2. int main () {
  3. const size_t bufsize = 1024*1024;
  4. char *buff = new char[bufsize];
  5. std::ofstream ofs("test.txt", std::ofstream::out);
  6. ofs.rdbuf()->pubsetbuf(buff, bufsize);
  7. ofs << "Hello, buffered stream!\n";
  8. return 0;
  9. }
Success #stdin #stdout 0s 4260KB
stdin
Standard input is empty
stdout
Standard output is empty