char * fcvt ( double value, int num, int * dec, int * sign );
Convert floating point value to string.
Converts the value to a null-terminated string of num digits. If num is greater than the representable digits of value the rest of the string is padded with zeros. If num is smaller the low-order digit is rounded.
Only digits are returned. The position of the decimal point can be otained from dec, that is a pointer to an int value representing the position of the decimal point respect to the beginning of the string (0 or less indicates that the decimal point lies to the left of the digits). The sign can be obtained from the sign parameter, that points to an int value: if this is 0, the value is positive, otherwise it is negative.
Actually acts exactly as ectv.
A null-terminated buffer with the legth specified by num that contains the digits of the value. Decimal point and sign are not returned in the buffer itself: see dec and sign parameters.
The buffer returned is a block of memory statically allocated and will be overwritten by further calls to this function.
Not defined in ANSI-C, but included in some compilers
/* fcvt example: scientific notations */
double value = 365.249;
int precision = 5;
int decimal, sign;
buffer = fcvt (value, precision, &decimal, &sign);
printf ("%c%c.%s x 10^%d\n",sign?'-':'+',buffer,buffer+1,decimal-1);
+3.6525 x 10^2