473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[fstream]how to set buffer

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

May 15 '06 #1
2 3940
Acer wrote:
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
May 16 '06 #2

"Acer" <Ya******@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
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

May 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Maya | last post by:
Apart from being a pointer, what would be the benefit of using 'std::filebuf' than using the std::fstream? As far as I can see, I would use the same methods in 'filebuf' that I would when using...
3
by: Venkat | last post by:
Hi All, Currently i guess rename and remove are not supported using fstream. How do i rename or remove a file? regards, Venkat
4
by: Thomas Matthews | last post by:
Hi, My objective is to add enable & disable functionality to the ofstream class. I want to have a log file where I can disable and enable output to it. When my first tests pass, I want to...
10
by: Alex Vinokur | last post by:
What is wrong with small_buffer in program below? I/O getline doesn't read data from file into small (relative to file line size) buffer. ====== foo.cpp ====== #include <cassert> #include...
2
by: bballmitch | last post by:
I have the following code #include <cstdlib> #include <iostream> #include <fstream> int score_one=2345, score_two=1800, score_three=1500, score_four=1300, score_five=1100; int ...
4
by: begum | last post by:
in my program ý want to use a help menu and i want to connect it with a .txt file. in case 4 ý want to use fstream. how can i do it? thank you. #include <iostream> #include<string.h> ...
6
by: SpreadTooThin | last post by:
How can I read in two characters from a file into a std::string? the long way: fstream f("myfile.bin", ios::binary | ios:in); // Opened for read binary... unsigned char buffer; buffer =...
2
by: mauricesmith42 | last post by:
Sorry i know this is rather large to be posting, but in order to understand the question you have to see all the code //#include <windows.h> //needed for opening folders #include...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.