Firstly I would like to apologize if I have used the words 'stream' and 'buffer' incorrectly.
In response to this question -> How to read blocks of data from a file and then read from that block into a vector?
I was told that reading record by record or block by block from file won't have much of an effect since the standard library already does buffering as it reads data from a file. Moreover, since it is possible to resize the buffer, it isn't necessary to read block by block. So, to test this I decided to do a little experiment of my own.
FILE *file;
file=fopen("out","r");
setvbuf(file,NULL,_IOFBF,1024);
char c=fgetc(file);
I have a file "out" which has 2048 characters. I associated a buffer of 1024 bytes with it via setvbuf. According to http://www.cplusplus.com/reference/cstdio/setvbuf/ , when an input operation is requested (with the mode _IOFBF), the buffer is completely filled. So when I ask to read a character via
char c=file.get()
the buffer should be completely filled, i.e., it should have the first half of file "out".
Now my question is how do I display the contents of the buffer so that I can verify my experiment (if my understanding is correct at all, that is)?
Thanks.