2.2.5.2.2 INIFile::GetKeyNames

Description

Get all the key names in a section into a string array.

Syntax

int GetKeyNames( StringArray & saKeys, LPCSTR lpcszSection )

Parameters

saKeys
[output] string array to receive the key names
lpcszSection
[input] pointer to the section name to get the key names from

Return

number of key names in the array

Examples

EX1

// This function will output Origin.ini file's section and key names.
void INIFile_GetKeyNames_ex1()
{
    string str;
    INIFile ini("Origin.ini");
    StringArray saSections, saKeys;
    ini.GetSectionNames(saSections);
    for( int iSection = 0; iSection < saSections.GetSize(); iSection++ )
    {
        printf("%s\n", saSections[iSection]);
        ini.GetKeyNames(saKeys, saSections[iSection]);
        for( int iKey = 0; iKey < saKeys.GetSize(); iKey++ )
        {
            str = ini.ReadString(saSections[iSection], saKeys[iKey]);
            printf("    %s = %s\n", saKeys[iKey], str);
        }
    }
}

Remark

See Also

Header to Include

origin.h