Item

ArrayGetCLen

Return the length of the text of an array element

Syntax

Signature
size_t ArrayGetCLen( const ITEM *array, size_t index );

Arguments

array Array to access.

index Element position, counted from 1.

Return value

The stored string length in bytes, or 0 for a missing element or a different type.

Description

Counts the bytes in the string without its terminating NUL. For a UTF-8 string, the byte count can differ from the character count.

Example

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

#include <stdio.h>

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

   if( !array )
      return 1;

   ArraySetC( array, 1, "Open" );
   printf( "Bytes: %zu\n", ArrayGetCLen( array, 1 ) );
   ItemRelease( array );

   return 0;
}