Function _parnl() Foundation

Returns the integer value of a numeric parameter.

Syntax
LONG _parnl(XppParamList pList, ULONG ulIndex, ...);
Parameters
XppParamList pList
Pointer to the Xbase++ parameter list, which is used to provide access to the parameter.
ULONG ulIndex
Position of the parameter which contains the numeric value (first parameter is 1).
...
The remaining arguments must be of ULONG type and are only considered when the parameter <ulIndex> is an array. In this case, an index is specified for each array dimension to select the element which has the numeric value. Warning:The end of the list of array indexes must be indicated with a NULL index.
Return

Returns the value of the numeric parameter as a LONG value. If the value is not an integer, it is rounded.

Description

_parnl() is used to read a numeric value from a parameter.

The numeric type in Xbase++ can have values which can not be represented in a LONG. No check for 'overflow' takes place. The return value is undefined if the parameter's value is too large. For numeric type parameters, the function _partype() returns additional information as to whether the value has decimal places or is too large to be converted to a LONG.

Examples
/* 
Reads a numeric value as LONG from a parameter. 
*/ 
#include <xpppar.h> 

LONG numLong; 
LONG type; 

type = _partype(<pList>, 5);  /* determine the type of parameter 5 */ 

/* Is it numeric value and not double? */ 
if ( XPP_IS_NUM( type )  &&  ! XPP_IS_FLOAT( type) ) 
{ 
numLong = _parnl(<pList>, 5); 
} 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.