Item

ItemPutStrUTF8

Copy UTF-8 text into an ITEM

Syntax

Signature
ITEM *ItemPutStrUTF8( ITEM *item, const char *value );

Arguments

item is an existing ITEM to replace. Pass NULL to allocate a new ITEM.

value is NUL-terminated UTF-8 text. Pass NULL for an empty string.

Return value

The destination ITEM, or a new caller-owned ITEM when item is NULL.

Description

Copies the supplied bytes as text. Use ItemGetCLen() for byte length and ItemGetCPtr() for access to the stored text.

Example

itemputstrutf8.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