Function _paralen() Foundation

Determines the number of elements in an array.

Syntax
ULONG _paralen(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 within the parameter list (first position is 1) of the parameter that is an array whose length is to be determined.
...
The remaining arguments must be of the ULONG type and identify which subarrays of a multidimensional array to determine the length of. An index is specified per array dimension to select the subarray. The end of the array index list must be indicated by incorporating a NULL as the last value in the list.
Return

Returns the length of the array. Arrays of length 0 are possible (if there are no elements). NULL is also returned when the parameter or the indexed array element does not refer to an array.

Description

_paralen() and _paratype() are used to determine the structure and size of multidimensional arrays. If the first array index passed to paralen() is NULL, the length of the entire array is returned. If non-NULL indexes into the array are passed, the length of the corresponding subarray is determined. In CA Clipper the function _parinfa() is used to determine similar information, but it does not support multidimensional arrays.

To determine the length of an array, a NULL index must always be passed to indicate the end of the index list. When the array is one dimensional, a single NULL value should be passed.

Examples
/* 
   The example determines the length of an array. 
*/ 
#include <xpppar.h> 

LONG   len; 
                                /* Is parameter 1 an array? */ 
if ( XPP_IS_ARRAY( _partype(<pList>, 1) ) ) 
{ 
   len = _paralen(<pList>, 1, 0);  /* determines the length */ 
} 
else 
   len = -1;                    /* error: store illegal length */ 

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.