
[Example]
The following program reads the custom macro variable data of
specified number and displays it.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <string.h>
/* number is variable number to be read. */
short example( short number )
{
struct odbm buf ;
char strbuf[11] ;
short ret ;
ret = cnc_rdmacro( number, 10, &buf ) ;
if ( !ret ) {
sprintf( &strbuf[1], "%09ld", buf.mcr_val ) ;
if ( strbuf[1] == '0' ) strbuf[1] = ' ' ;
strncpy( &strbuf[0], &strbuf[1], 9 - buf.dec_val ) ;
strbuf[9-buf.dec_val] = '.' ;
printf( "%s¥n", strbuf ) ;
}
else
printf( "**********¥n" ) ;
return ( ret ) ;
}