Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 466 -
The standard value of "dec_val" is as follows.
CNC system setting dec_val
-----------------------+--------
IS-B and mm input 3
IS-C or inch input 4
[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. */
int example( int number )
{
struct odbm buf ;
char strbuf[11] ;
int 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 ) ;
}