Item

ItemGetCLen

Get the number of bytes in an ITEM string

Syntax

Signature
size_t ItemGetCLen( const ITEM *item );

Arguments

item is the ITEM to read.

Return value

The stored string length in bytes, or 0 for NULL or a value of another type.

Description

The count excludes the terminating NUL. A UTF-8 character may use several bytes.

Example

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

#include <stdio.h>

int main( void )
{
   ITEM *item = ItemPutStrUTF8( NULL, "Caf\xC3\xA9" );

   printf( "%zu bytes\n", ItemGetCLen( item ) );
   ItemRelease( item );

   return 0;
}

Output

5 bytes

See also