HP C/iX Library Reference Manual (30026-90004)

134 Chapter5
HP C/iX Library Function Descriptions
ecvt
ecvt
Converts a floating-point number to a string.
Syntax
char *ecvt (double
value
, int
ndigit
, int *
decpt
, int
sign
);
Parameters
value
The floating-point number to be converted to a character string.
ndigit
The number of digits to convert.
decpt
A pointer to an integer to which the position of the decimal point relative
to the beginning of the string is returned.
sign
A pointer to an integer to which a flag indicating the sign of the number is
returned.
Return Values
x A pointer to a character array containing the results of the conversion.
Description
The ecvt function converts
value
to a null-terminated string of
ndigit
digits and returns
a pointer to the string. The resulting numeric string is rounded and left-justified without
leading zeros. The position of the decimal point relative to the beginning of the string is
stored indirectly through
decpt
(negative means to the left of the returned digits). The
decimal point is not included in the returned string. If the sign of the result is negative, the
word pointed to by
sign
is non-zero. Otherwise, the word pointed to by
sign
is zero.
The values returned by ecvt() point to a single static data array whose content is
overwritten by each call.
See Also
fcvt(), gcvt()