INIFile::ReadInt

Description

Retrieves an integer value from the specified section in an initialization file

Syntax

int ReadInt( LPCSTR lpcszSection, LPCSTR lpcszKey, int nDefault )

Parameters

lpcszSection
[Input] section name
lpcszKey
[Input] key name
nDefault
[Input] return value if section or key is not found in initialization file

Return

integer value specified by section and key from initialization file

Examples

EX1

//gets current value for Initial Origin window state from Origin.ini file
//see "Config" section in Origin.ini for more details
void INIFile_ReadInt_ex1()
{
    string strFileName = GetAppPath(1)+ "Origin.ini";
    INIFile ini(strFileName);
    printf("Initial Origin window state is %d", ini.ReadInt("Config", "ShowState", -1));
}

Remark

See Also

header to Include

origin.h