DWORD GetPrivateProfileSection(lpszSection, lpszReturnBuffer, cchBuffer, lpszFile) | |||||
LPCTSTR lpszSection; | /* address of the section name | */ | |||
LPTSTR lpszReturnBuffer; | /* address of the return buffer | */ | |||
DWORD cchBuffer; | /* size of the return buffer | */ | |||
LPCTSTR lpszFile; | /* address of the initialization file name | */ |
This function retrieves all of the key name and value pairs for a particular section from the specified initialization file.
lpszSection
Points to a null-terminated string containing the section heading in the initialization file.
lpszReturnBuffer
Points to the buffer that receives the key name and value pairs associated with the named section. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character.
cchBuffer
Specifies the size (in characters) of the buffer at lpszReturnBuffer.
lpszFile
Points to a null-terminated string that names the initialization file. If lpszFile does not contain a path to the file, Windows searches for the file in the Windows directory.
The return value specifies the number of characters copied to lpszReturnBuffer, not including the terminating null character. If the buffer is not large enough to contain all the key name and value pairs associated with the named application section, the return value is equal to the length specified by the cchBuffer parameter minus 2.
The GetPrivateProfileSection 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).
The format of the returned key name and value pairs is one or more null terminated strings, terminated by the final null character. Each string has the following format:
KeyName=Value
GetPrivateProfileSection is not case-dependent, so the strings in lpszSection may be in any combination of uppercase and lowercase letters.
This operation is atomic; no updates to the specified initialization file are allowed while the key name and value pairs for the application section are being copied to the lpszReturnBuffer buffer.
GetPrivateProfileInt, GetPrivateProfileString, GetProfileSection, WritePrivateProfileString, WritePrivateProfileSection, WriteProfileSection