diff --git a/examples/tiny.c b/examples/tiny.c index f3ba9e6e..cbe29025 100644 --- a/examples/tiny.c +++ b/examples/tiny.c @@ -20,6 +20,8 @@ coap_pdu_t * make_pdu( unsigned int value ) { coap_pdu_t *pdu; unsigned char enc; + static char buf[20]; + int len; if ( ! ( pdu = coap_new_pdu() ) ) return NULL; @@ -30,6 +32,11 @@ make_pdu( unsigned int value ) { enc = COAP_PSEUDOFP_ENCODE(value); coap_add_data( pdu, 1, &enc); + len = snprintf(buf, 20, "%u", COAP_PSEUDOFP_DECODE(enc)); + if ( len > 0 ) { + coap_add_data( pdu, len, buf ); + } + return pdu; }