BOOL WriteProfileSection(lpszSection, lpszString) | |||
LPCTSTR lpszSection; | |||
LPCTSTR lpszString; |
This function replaces the entire contents of the application section in the Windows initialization file, WIN.INI, as named by the lpszSection parameter, with the key name, value pairs specified in the lpszString parameter.
If there is no matching application section name, this functions creates the section at the end of the Windows initialization file and initializes the new section with the key name and value pairs specified in the lpszString parameter.
lpszSection
Points to a null-terminated character string that names the application.
lpszString
Points to the buffer that contains the new key name and value pairs associated to be written to the named application section.
The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.
The format of the key name, value pairs in the lpszString buffer, is one or more null terminated strings, terminated by the final null character. Each string has the following format:
KeyName=Value
WriteProfileSection is not case-dependent, so the strings in lpszSection may be in any combination of uppercase and lowercase letters.
This operation deletes all of the existing key name and value pairs for the named application section and then inserts the new key name and value pairs contained in the lpszString buffer. No attempt is made to correlate old and new key names, so if the new names appear in a different order than the old key names, then any comment lines in the section will be probably be associated with the wrong key name, value pairs.
This operation is atomic, in that no other reads or writes to to the Windows initialization file are allowed while the key name, value pairs for the application section are being written.
The WriteProfileSection function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).
GetPrivateProfileSection, GetPrivateProfileInt, GetPrivateProfileString, GetProfileSection, GetProfileInt, GetProfileString, WritePrivateProfileString, WriteProfileString, WritePrivateProfileSection