tree_get_ini_section

 

Description

Get the tree node that represents a specified ini section.

Syntax

TreeNode tree_get_ini_section( TreeNode & trIni, LPCSTR lpcszSection )

Parameters

trIni
[input]tree node that represents an ini file
lpcszSection
[input]pointer to an ini section name

Return

If a tree node representing the specified ini section then it is returned, else an invalid tree node is returned.

Examples

EX1

void tree_get_ini_section_ex1()
{
        Tree tr;
        StringArray saSections;
        string strFileName = okutil_get_origin_path(USER_FOLDER) +"NLSF.ini";
        if (!strFileName.IsFile() )
        {
                out_str("File isn't exist! Please check it!");
                return;
        }
        INIFile iniFile(strFileName, TRUE);
        
        iniFile.GetSectionNames(saSections);
        
        if( tree_read_ini(tr, iniFile) )
        {
                TreeNode tn;
                int nSize = saSections.GetSize();
                for( int ii = 0; ii < nSize; ii++ )
                {
                        tn = tree_get_ini_section(tr, saSections[0]);     
                        if( tn )
                                out_tree(tn);
                        else
                                out_str("No");
                }
        }
}

Remark

See Also

tree_read_ini

header to Include

origin.h

Reference