Function _conArrayGetA() Foundation

Assign an element of an array of any dimension to a container.

Syntax
ContainerHandle _conArrayGetA(ContainerHandle chArray,
                              ContainerHandle chResult,
                              int *index);
Parameters
ContainerHandle chArray
Handle of a container of n-dimensional array type.
ContainerHandle chResult
Handle of a container which will contain the value. If NULLCONTAINERis passed, a new container will be created.
Integer* index
index is a 0-terminated field of integers that describe the array index. For example, if the value of element [1][2] of the Array chArray shall be stored to the container chResult, index has to point to a field {1,2,0}.
Return

This function returns a handle to a container that holds the requested value.

Description

The function _conArrayGetA() is used to assign the values of array elements to a container. Xbase++ arrays can contain elements of different types. The value of the array element determined by the pointer index is passed to the container chResult.

Examples
#include <windows.h> 

#include "xppdef.h" 
#include "xpppar.h" 
#include "xppcon.h" 

XPPRET XPPENTRY MyCAPIFunction(XppParamList paramList) 
{ 
/* Declare and initialize variables */ 
ContainerHandle chArray; 
ContainerHandle chDest; 
ContainerHandle chOldValue; 
BOOL bchArrayRef; 
int index[] = { 1,2,0 }; 

/* Get array from parameter list. It is expected to */ 
/* be the first parameter.                          */ 
chArray = _conParam( paramList, 1, &bchArrayRef ); 

/* Get old value from array field [1,2]. */ 
/* A two dimensional array is expected.  */ 
chOldValue = _conArrayGetA( chArray, NULLCONTAINER, index); 

/* Prepare container */ 
chDest = _conPutC( NULLCONTAINER, "New Value" ); 

/* Store new value to array field [1,2] */ 
if (_conArrayPutA( chArray, chDest, index)) 
{ 
  /* Operation unsuccessful... */ 
  /* ...handle the error.      */ 
} 

/* Return old value */ 
_conReturn( paramList, chOldValue ); 

/* Release containers */ 
_conRelease( chArray ); 
_conRelease( chDest ); 
_conRelease( chOldValue ); 
} 



/* Xbase++ Code */ 
PROCEDURE Main 
LOCAL aMyArray := { {"A", "A"}, ; 
                    {"B", "B"}, ; 
                    {"C", "C"}  } 

CLS 

? aMyArray 

? MyCAPIFunction( aMyArray ) 

? aMyArray 
RETURN 
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.