decfcvt()

Converts a decimal value to a string value.

Syntax

char *decfcvt(dec_t *np, mint ndigit, mint *decpt, mint *sign);
  1. np is a pointer to a decimal structure that contains the decimal value you want to convert.
  2. ndigit is the number of digits to the right of the decimal point.
  3. decpt is a pointer to an integer that is the position of the decimal point relative to the start of the string.
  4. sign is a pointer to the sign of the result.

Usage

Specifying the number of digits to the right of the decimal point with the ndigit parameter.

A negative or zero value fordecpt means to the left of the returned digits.

If the sign of the result is negative, sign is nonzero; otherwise, sign is zero.

Returns

This function returns a pointer to the result string. This string is temporary and has to be copied into your own string buffer.