dececvt()

Converts a decimal value to a string value.

Syntax

char *dececvt(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 length of the ASCII string.
  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

You must specifying the length of the string in ndigit (the total number of digits).

The function rounds low-order digits.

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.