Article ID: 68827 - Last Review: October 30, 2003 - Revision: 2.0 Updating Cached Private Profiles (.INI Files)
This article was previously published under Q68827 SUMMARY
Under Windows version 3.1, the first time a private profile (.INI file) is
accessed, the system will call the GetFileTime() API and store this value.
The WriteProfileString() API will then call the GetFileTime() API and
compare the return value to the stored value. If the two values match, the
file is considered valid for two seconds. The function makes the changes
and writes the new contents to disk. If the two values do not match, the
profile is reread into a buffer and the change is made. The same principle
holds true for reading values from a private profile.
The reasoning behind the two second limit is that most applications read private profiles in a burst, at application startup, and write in a burst, at application shutdown. The penalty of one read in a twenty read sequence is considered acceptable, given the benefits. In Windows version 3.0, an application that has a private profile will not respond to changes made to that private profile by a text editor. When a text editor updates a private profile, the file on disk is modified. However, GetPrivateProfileString() and GetPrivateProfileInt() do not read from the disk file, instead the functions read from a copy of the file in a cache. WritePrivateProfileString() will update the appropriate sections in both the cached file and the disk file, however, the functions will not reload the disk file into the cache unless the entire cache is invalidated. The information included below discusses how to force a private profile to be recached from a disk file. MORE INFORMATION
Windows caches .INI files to reduce access time. This design allows
the file to remain in memory until a different .INI file is loaded or
until an application forces recaching of the file.
To force an .INI file to be recached, make the following call (where <fname.ini> is the name of the application's private profile): While .INI files are cached to optimize access time, the following are examples of how and when an .INI file could be recached.
APPLIES TO
| Other Resources Other Support Sites
CommunityArticle Translations |






















Back to the top