[fstream]how to set buffer

A

Acer

platform: freeBSD(gcc) Win32(MinGW)
I try follows:

char cbuf[buf_size];
ifstream fin;
fin.rdbuf()->pubsetbuf(cbuf,buf_size);

but I found it do not influence the I/O times when I increased or
decreased the buf_size
 
T

Tom Widmer

Acer said:
platform: freeBSD(gcc) Win32(MinGW)
I try follows:

char cbuf[buf_size];
ifstream fin;
fin.rdbuf()->pubsetbuf(cbuf,buf_size);

The behaviour of that is implementation defined, but I think it does
what you want on your compiler and platform. Make sure you set the
buffer before you open the file.
but I found it do not influence the I/O times when I increased or
decreased the buf_size

That implies that your I/O times are not being influenced by buffering.

Tom
 
S

Sirish Kumar

Acer said:
platform: freeBSD(gcc) Win32(MinGW)
I try follows:

char cbuf[buf_size];
ifstream fin;
fin.rdbuf()->pubsetbuf(cbuf,buf_size);

but I found it do not influence the I/O times when I increased or
decreased the buf_size
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top