Function _conArrayPutA() Foundation
Assign the value of a container to an element of an array of any dimension.
XPPAPIRET _conArrayPutA(ContainerHandle chArray,
ContainerHandle chValue,
int *index);
The function returns an error code (XPP_ERR_...) when the operation was not successful, otherwise the return value is NULL.
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.
#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
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.