Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > another c++ i/o questions

Reply
Thread Tools

another c++ i/o questions

 
 
Doug Harvey
Guest
Posts: n/a
 
      08-26-2005

I have a question that hopefully someone here has already figured out

I have more experience programming in "C", and in order to improve I/
throughput we would use setvbuf() to increase the buffer size tha
fread/read used when reading files. It made a pretty big difference
I tried the following

char mybuffer[1000000]
inp.rdbuf()->pubsetbuf(mybuffer,1000000)

while (getline((inp),line))
..

but it changed the output, seemed like it no longer read all of th
data
Any thoughts on the above would be appreciated

Also, is the read() function the proper way to read fixed-length record
using the C++ i/o libraries
Thanks in advance of course

dou

--


 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      08-26-2005
Doug Harvey wrote:
> I have a question that hopefully someone here has already figured out.
>
> I have more experience programming in "C", and in order to improve I/O
> throughput we would use setvbuf() to increase the buffer size that
> fread/read used when reading files. It made a pretty big difference.
> I tried the following:
>
> char mybuffer[1000000];
> inp.rdbuf()->pubsetbuf(mybuffer,1000000);
>
> while (getline((inp),line)) {
> ...
>
> but it changed the output,


In what way? What was the output before and what is it after? "Changed"
isn't much to work on.

> seemed like it no longer read all of the
> data.


How much of the data does it read? 10%? 90%? 99.9%? What's missing?

> Any thoughts on the above would be appreciated.


From the archives: pubsetbuf does not guaranteed to turn buffering on.
See this: http://tinyurl.com/7a9a6 (I searched for 'pubsetbuf')

>
> Also, is the read() function the proper way to read fixed-length records
> using the C++ i/o libraries?


Sure.

Perhaps you could be a good sport and read the FAQ first. Perhaps after
that you would consider following the recommendation of FAQ 5.8...

V
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to force a load of one control from another control on another form? et ASP .Net 1 06-29-2005 07:45 PM
Renaming a project with another project as the starting point? In another solution Maziar Aflatoun ASP .Net 1 01-22-2005 12:49 AM
How to access: a page from a User control, and another User controlfrom another one? qwerty ASP .Net 3 09-30-2004 05:32 PM
Access a control inside an usercontrol from another control inside another usercontrol nail ASP .Net 0 09-15-2004 03:55 PM
Re: Questions....questions....questions Patrick Michael A+ Certification 0 06-16-2004 04:53 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57