Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
ecvt, fcvt, gcvt
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The ecvt, fcvt, and gcvt functions convert a floating-point number
to a character string. The <value> argument is the floating-point
number to be converted. The ecvt and fcvt functions store up to
<count> digits of <value> as a string and append a null character
(\0). If the number of digits in <value> exceeds <count>, the
low-order digit is rounded. If there are fewer than <count>
digits, the string is padded with zeros.
Only digits are stored in the string. The position of the decimal
point and the sign of <value> can be obtained from <dec> and
<sign> after the call. The <dec> argument points to an integer
value giving the position of the decimal point with respect to the
beginning of the string. A 0 or negative integer value indicates
that the decimal point lies to the left of the first digit. The
<sign> argument points to an integer indicating the sign of the
converted number. If the integer value is 0, the number is
positive; otherwise, it is negative.
The gcvt function converts a floating-point value to a character
string and stores the string in <buffer>. The buffer should be
large enough to accommodate the converted value plus a terminating
null character (\0), which is automatically appended. There is
no provision for overflow.
The gcvt function produces <digits> significant digits. The output
is in decimal format for values greater than or equal to 0.1, and
in exponential format for values less than 0.1. Trailing zeros may
be suppressed in the conversion.
The ecvt and fcvt functions use a single statically allocated
buffer for the conversion. Each call to one of these routines
destroys the result of the previous call.
Return Value
The functions return a pointer to the string of digits. There is
no error return.
-♦-