2.2.5.2.10 INIFile::WriteInt

Description

Writes integer value into the specified section of an initialization file

Syntax

void WriteInt( LPCSTR lpcszSection, LPCSTR lpcszKey, int nValue )

Parameters

lpcszSection
[Input] section name
lpcszKey
[Input] key name
nValue
[Input] value to be written

Return

Examples

EX1

//This example writes integer value into the Config section of MyOrigin.ini.
//For this example to run, a file with followint content named MyOrigin.ini should exist under C:\ folder.
//[Config]
//ShowState=1
void INIFile_WriteInt_ex1()
{
    int iState = 3;
    INIFile iniMyF("C:\\MyOrigin.ini");
 
    iniMyF.WriteInt("Config", "ShowState", iState);
    printf("Set initial Origin window state to %d\n", iState);
 
    if (iState == iniMyF.ReadInt("Config", "ShowState", -1))
        printf("Success!\ninitial Origin window state is %d\n",iState);
    else 
        out_str("Error!");
}

Remark

See Also

Header to Include

origin.h