[comp.windows.ms.programmer] GetPrivateProfileString and fprintf

bonneau@hyper.hyper.com (Paul Bonneau) (03/21/91)

Hi all,

This is my problem.  I am getting stuff from a private .ini
file using GetPrivateProfileString().  When it comes time to
write it out, so many things have changed, that it is much
faster to simply recreate the file with a series of
fprintf()'s than WritePrivateProfileStrings()'s.

Problem is, apparently windows buffers the .ini file, so that
GetPrivateProfileString() is faster.  But on the next
invocation of the program, the old buffer is being reused, so
that the new .ini file (created with fprintf()'s) is not
being read.

Anybody else come up against this problem?  Have any
suggestions?  Currently, I am calling GlobalCompact(-1)
to flush all discardable segments, which flushes the segment
containing the buffered memory.  As you can imagine, this
causes a few disk hits to reload everything (;->).

cheers - Paul Bonneau.