fast way to read NON-readonly files

C

chad kline

since i figured out the problem before my post appeared,
and don't want to waste people's time replying - i want
to add that the reason for the slowness in reading in
large files was due to the failure to use "realloc()".
the slowness was due to using malloc()/strcpy()/free().
 
T

Thomas Matthews

chad said:
since i figured out the problem before my post appeared,
and don't want to waste people's time replying - i want
to add that the reason for the slowness in reading in
large files was due to the failure to use "realloc()".
the slowness was due to using malloc()/strcpy()/free().

Many applications that want improved I/O speed do not
use realloc. The applications allocate a static buffer
and haul a large chunk o' data into the buffer, then
parse away.

The goal is to keep the I/O medium in constant flow.
When the medium stops, there will be time required
for it to "ramp up" and seek to the previous location
of where it started. One method to this is to reduce
the quantity of I/O requests. One big access is
generally faster than a whole bunch of little ones.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top