The iff_get_scalar() function takes two arguments: the first is a pointer to a character string (up to 128 characters) that names an existing IFEFFIT scalar (following the naming rules outlined in chapter 3), and the second is a pointer to a double. The effect is to retrieve the value of the named IFEFFIT scalar and put it into the provided C pointer. If the scalar does not exist in the IFEFFIT session, the value will be set to 0.
iff_get_scalar() always returns 0.
double *x;
x = calloc(1,sizeof(double));
i = ifeffit(' set var = sqrt(100.0)');
i = iff_get_scalar('var', x);
printf(" x = %g \n", *x);
would show x to have the value 10.0.
A more convenient version of this function is also available: The iff_scaval() function takes one arguments: the name of an existing IFEFFIT scalar, and returns a pointer to its double value. The above code could thus be rewritten as
double *x;
i = ifeffit(' set var = sqrt(100.0)');
x = iff_scaval('var');
printf(" x = %g \n", *x);
would show x to have the value 10.0.