2.1.26.61 tree_read_ini_section


Description

Read an ini section into a tree node.

Syntax

bool tree_read_ini_section( TreeNode & trIni, LPCSTR lpcszFile, LPCSTR lpcszSection )


bool tree_read_ini_section( TreeNode & trIni, INIFile & iniFile, LPCSTR lpcszSection )

Parameters

trIni
[output]tree node to receive the ini section
lpcszFile
[input]pointer to an ini file name
lpcszSection
[input]pointer to an ini section name


trIni
[output]tree node to receive the ini section
iniFile
[input]the ini file to read from
lpcszSection
[input]pointer to an ini section name

Return

true for success, false for error

Examples

EX1

//Output content of  "Origin Basic Functions" section of NLSF.ini
void tree_read_ini_section_ex1()
{    
    Tree trIni;
    
    char szFile[] = "nlsf.ini";
    char szSection[] = "Origin Basic Functions";
    if(tree_read_ini_section(trIni, szFile,szSection ))
        out_tree(trIni);
}


EX2

//Output content of "Origin Basic Functions" section of NLSF.ini and append an user function to this Section.
void tree_read_ini_section_ex2()
{    
    Tree trIni;
    
    INIFile iniFile("NLSF.ini");
    char szSection[] = "Origin Basic Functions";
    if(tree_read_ini_section(trIni, iniFile, szSection ))
    {
        out_tree(trIni);
        trIni.OriginBasicFunctions.AddTextNode("Func1", "Func1");
    }
    if(tree_write_ini(trIni, iniFile))
        out_tree(trIni);
    
}

Remark

See Also

tree_read_ini

Header to Include

origin.h

Reference