Item

ItemCopy

Copy one ITEM into another

Syntax

Signature
void ItemCopy( ITEM *destination, const ITEM *source );

Arguments

destination is the ITEM to replace.

source is the value to copy. Pass NULL to clear the destination.

Return value

No return value.

Description

The destination owns an independent copy of a string. An array is not copied: the destination holds the same array, and a change of its elements is seen through both. AClone() duplicates an array. Pointer and callback values retain the addresses stored in the source.

Example

itemcopy.c
#include "xdev-wtui.h"

#include <stdio.h>

int main( void )
{
   ITEM *source = ItemPutC( NULL, "Open" );
   ITEM *destination = ItemNew( NULL );

   ItemCopy( destination, source );
   ItemRelease( source );
   puts( ItemGetCPtr( destination ) );
   ItemRelease( destination );

   return 0;
}

Output

Open

See also