2.1.26.71 tree_write_ini_section


Description

Write a tree node, that represents an ini section, to an ini file.

Syntax

bool tree_write_ini_section( TreeNode & trIniSection, INIFile & iniFile, bool bClearSection = false, bool bLabelAsKey = true )

Parameters

trIniSection
[input]tree node representing an ini section
iniFile
[output]ini file to be written to
bClearSection
[input] true will clear eixsting content of the ini section, false will not
bLabelAsKey
[input]true, make tree label attribute as key name; else tagName will be key name.
When bLabelAsKey is false, will use treenode tagName as key name, if want to get label of some special treenodes as key name,
can set STR_COMPLEX_ININAME_ATTRIBUTE attribute as true for these treenodes.

Return

true for success, false for error

Examples

EX1

//Clear and Write "Other" section of origin.ini
void tree_write_ini_section_ex1()
{    
    Tree trIniSection;
    INIFile iniFile("Origin.ini");
    if(tree_read_ini_section(trIniSection, iniFile, "Other"))
    {

        if(trIniSection.Other)
            trIniSection.Other.AddNumericNode(0,"MySetting");

    }
    if(tree_write_ini_section(trIniSection, iniFile, true))
        out_tree(trIniSection);
    
}

Remark

See Also

tree_read_ini_section

Header to Include

origin.h

Reference