3.9 Initialization-File Functions

Initialization-file functions obtain information from and copy information to a Windows or private (application-specific) initialization file. The Windows initialization file (WIN.INI) is a special ASCII file that contains entry-value pairs representing run-time options for applications. Following are the initialization-file functions:

Function Description

GetPrivateProfileInt Returns an integer value in a section from a private initialization file.
GetPrivateProfileString Returns a character string in a section from a private initialization file.
GetProfileInt Returns an integer value in a section from the WIN.INI file.
GetProfileString Returns a character string in a section from the WIN.INI file.
WritePrivateProfileString Copies a character string to a private initialization file or deletes one or more lines from a private initialization file.
WriteProfileString Copies a character string to the WIN.INI file or deletes one or more lines from WIN.INI.

An application should use a private initialization file to record information that affects it alone. This improves the performance of the application and Windows by reducing the amount of information that Windows must read when it accesses the initialization file. An application should record information in WIN.INI only if the information affects the Windows environment or other applications and should send the WM_WININICHANGE message to all top-level windows.

The WININI.WRI and SYSINI.WRI files supplied with the retail version of Windows describe the contents of the WIN.INI and SYSTEM.INI files.