[comp.lang.c] Quick C Stream Flushing

iroberts@g.adelaide.edu.au (02/13/91)

Help!

I have a programme written in Microsoft Quick C.
It compiles and runs OK on my PC but is very slow due to unnecessary disk
operations.

The programme receives keyboard input performs some simple calculations then
writes the results to disk using fprintf. I have attempted to adjust BUFFERS so
that a complete record can be held in memory. I have used fflush to flush the
stream to disk at the end of one set of records.

This works fine on the first pass through this loop but on subsequent passes the
stream is flushed much more often. It seems to be flushed when the following
functions are called:

        system("cls");
        flush(stdin);

I cannot understand why this occurs.