Trying to fread_s or ifstream.read without buffering/caching!

G

gustavo.samour

Hi,

I'm trying to code an application that reads files from the DVD drive.
The problem I have is that the files are being cached/buffered. So the
first time I run the application, the files are read from the DVD, but
the second time I run it and the next times after that, the files are
read from cache instead of being read from DVD. Normally, buffering/
caching is a good thing. But this is for a benchmark type application
in which I need to read files from the DVD every single time. I'm
currently using FILE* and fread_s. To avoid buffering I call:

setvbuf( myfile, NULL, _IONBF, 0 );

But that doesn't help. Maybe it does, but perhaps there are more
caching mechanisms in place. Can anyone please help me out?
 
J

Jerry Coffin

Hi,

I'm trying to code an application that reads files from the DVD drive.
The problem I have is that the files are being cached/buffered. So the
first time I run the application, the files are read from the DVD, but
the second time I run it and the next times after that, the files are
read from cache instead of being read from DVD. Normally, buffering/
caching is a good thing. But this is for a benchmark type application
in which I need to read files from the DVD every single time. I'm
currently using FILE* and fread_s. To avoid buffering I call:

setvbuf( myfile, NULL, _IONBF, 0 );

But that doesn't help. Maybe it does, but perhaps there are more
caching mechanisms in place. Can anyone please help me out?

You'll need to do things that are specific to the Windows, and have
essentially nothing to do with C++, so you're probably better off asking
someplace like comp.os.ms-windows.programmer.win32. A question about
FILE_FLAG_NO_BUFFERING will probably get things started in the right
direction.
 
G

gustavo.samour

You'll need to do things that are specific to the Windows, and have
essentially nothing to do with C++, so you're probably better off asking
someplace like comp.os.ms-windows.programmer.win32. A question about
FILE_FLAG_NO_BUFFERING will probably get things started in the right
direction.

--
    Later,
    Jerry.

The universe is a figment of its own imagination.

Thanks Jerry.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top