Item

ItemGetBlock

Read an ItemBlock callback from an ITEM

Syntax

Signature
ItemBlock ItemGetBlock( const ITEM *item );

Arguments

item is the ITEM to read.

Return value

The stored callback, or NULL if the input is NULL or has another type.

Description

Check the returned function pointer before calling it.

Example

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

#include <stdio.h>

static int doubleValue( int value )
{
   return value * 2;
}

int main( void )
{
   ITEM *item = ItemPutBlock( NULL, doubleValue );
   ItemBlock operation = ItemGetBlock( item );

   if( operation )
      printf( "%d\n", operation( 21 ) );
   ItemRelease( item );

   return 0;
}

Output

42

See also