Function _conPut() Foundation

Assigns the value of a container to another container.

Syntax
ContainerHandle _conPut(ContainerHandle chDest, ContainerHandle chSrc);
Parameters
ContainerHandle chDest
Handle of the destination container or NULLCONTAINER.
ContainerHandle chSrc
Handle of the container whose value is to be copied or NULLCONTAINER.
Return

Returns the passed (chDest) or a newly created container handle. The return value is NULLCONTAINER if an error has occurred.

Description

Using this function an available container can be assigned the value of another container regardless of its type. When the passed container handle chDest has the value NULLCONTAINER, a new container is created as if calling _conNew(). If chSrc is NULLCONTAINER the value of the destination container will be NIL.

When a new container is created, it must be released with _conRelease() when it is no longer needed.

Examples
/* 
Assignment of any container value to a parameter: 
*/ 
#include <xppcon.h> 

ContainerHandle  hSrc; 
ContainerHandle  hDest; 
BOOL             isRef; 
XPPAPIRET        xr; 

hSrc = _conPutC(NULLCONTAINER, 
             "This container has a string"); 

hDest = _conParam(<pList>, 1, &isRef); 

if (hSrc == NULLCONTAINER || hDest == NULLCONTAINER 
 || !isRef 
 || _conPut(hDest, hSrc) == NULLCONTAINER) 
{ 
xr = _conLastError(); 
/* ... error handling */ 

/* 
   release parameter container 
   (if not passed by reference) 
*/ 
if (hDest != NULLCONTAINER  &&  !isRef) 
   _conRelease(hDest); 
} 
else 
conRelease(hSrc); 

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.