2.2.5.2.5 INIFile::ReadDouble

Description

Read key value that has double type

Syntax

double ReadDouble( LPCSTR lpcszSection, LPCSTR lpcszKey, double dDefault )

Parameters

lpcszSection
[input] Section name
lpcszKey
[input] Key name
dDefault
[input] Default value to return when target Key lpcszKey doesn't exist

Return

Examples

EX1

void INIFile_ReadDouble_ex1()
{
    // reads and prints all the key values in all sections that has double type
    INIFile ini("filename.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++ )
        {
            double dVal = ini.ReadDouble(saSections[iSection], saKeys[iKey], NANUM);
            printf("    %s = %lf\n", saKeys[iKey], dVal);
        }
    }
}

Remark

See Also

INIFile::ReadString

Header to Include

origin.h