Problem – Retrieve all Sections from ini File

Article Tools

API Syntax :

DWORD GetPrivateProfileSectionNames(

LPCTSTR lpszReturnBuffer,

DWORD nSize,

LPCTSTR lpFileName

);

Parameters :

clip_image001 lpszReturnBuffer – [out] buffer that receives the section names associated with the named file. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character

clip_image001[1] nSize – [in] The size of the buffer pointed to by the lpszReturnBuffer parameter, in characters.

clip_image001[2] lpFileName – [in] The name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.

Return Value : The return value specifies the number of characters copied to the specified buffer, not including the terminating null character. If the buffer is not large enough to contain all the section names associated with the specified initialization file, the return value is equal to the size specified by nSize minus two.

This function does not with QTP. this is because the returned string value is delimited with Null. so, QTP string are null terminated, so only the first string is returned, even that the buffer size is bigger.

Previous postReading a Specific Key String from ini File Next postWriting a Specific Key String to ini File

Related Posts

Post Your Comment

You must be logged in to post a comment.