Say I do this (a contrived example):
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
ifstream ifs(argv[1]);
char ch;
while(ifs.read(&ch, 1)) {
cout << ch;
}
}
I assume(hope) that the iostream library does some internal buffering here and doesn't turn this into gazillions of one-byte file-read operations at the OS level.
Is there a way of:
a) Finding out the size of ifstream's internal buffer?
b) Changing the size of ifstream's internal buffer?
I'm writing a file filter that needs to read multi-gigabyte files in small chunks and I'd like to experiment with different buffer sizes to see if it affects performance.