2.1.26.57 tree_node_get_int


Description

Get int value from a tree node, whether it is valid or not

Syntax

int tree_node_get_int( TreeNode & tr, int nDefault = 0 )

Parameters

tr
[Input]TreeNode to get
nDefault
[Input]default value in case node is not a valid node

Return

Returns the integer value

Examples

EX1

void tree_node_get_int_ex1()
{        
    Tree tr;
    TreeNode trFirst = tr.AddNumericNode(1.0, "First", 1);
    
    int nVal = tree_node_get_int(trFirst, 0);
    printf("%d\n", nVal); //it is 1.0
    nVal = tree_node_get_int(tr.InvalidNode, 0);
    printf("%d\n", nVal); //the result is 0 for default        
}

Remark

See Also

Header to Include

origin.h

Reference