Function _conArrayPutA() Foundation

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

Syntax
XPPAPIRET _conArrayPutA(ContainerHandle chArray,
                        ContainerHandle chValue,
                        int *index);
Parameters
ContainerHandle chArray
Handle of a container of array type whose element is to have its value changed.
ContainerHandle chValue
Handle of a container which has the new value.
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 has to be changed, index has to point to a field {1,2,0}.
Return

The function returns an error code (XPP_ERR_...) when the operation was not successful, otherwise the return value is NULL.

Description

The function _conArrayPutA() is used to change the values of array elements. Xbase++ arrays can contain elements of different types. The value of the passed container chValue is merely copied into the array element defined by the field pointed to by index.

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.