Item

ArraySetC

Put a copy of a text into an array element

Syntax

Signature
int ArraySetC( ITEM *array, size_t index, const char *value );

Arguments

array Array to access.

index Element position, counted from 1.

value NUL-terminated text to copy, or NULL to store an empty string.

Return value

1; 0 outside the array. The index counts from 1.

Description

The element gets its own copy of value; NULL gives "".

Example

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

#include <stdio.h>

int main( void )
{
   ITEM *array = Array( 2 );

   if( !array )
      return 1;

   ArraySetC( array, 1, "Open" );
   printf( "%s\n", ArrayGetCPtr( array, 1 ) );
   ItemRelease( array );

   return 0;
}