Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdlib.h>
    char *ecvt( double value,
                int ndigits,
                int *dec,
                int *sign );

Description:
    The ecvt function converts the floating-point number value into a
    character string.  The parameter ndigits specifies the number of
    significant digits desired.  The converted number will be rounded to
    ndigits of precision.

    The character string will contain only digits and is terminated by a
    null character.  The integer pointed to by dec will be filled in with a
    value indicating the position of the decimal point relative to the start
    of the string of digits.  A zero or negative value indicates that the
    decimal point lies to the left of the first digit.  The integer pointed
    to by sign will contain 0 if the number is positive, and non-zero if the
    number is negative.

Returns:
    The ecvt function returns a pointer to a static buffer containing the
    converted string of digits.  Note:   ecvt and  fcvt both use the same
    static buffer.

See Also:
    fcvt, gcvt, printf

Example:
    #include <stdio.h>
    #include <stdlib.h>

    void main()
      {
         char *str;
         int  dec, sign;

         str = ecvt( 123.456789, 6, &dec, &sign );
         printf( "str=%s, dec=%d, sign=%d\n", str,dec,sign );
      }

    produces the following:

    str=123457, dec=3, sign=0

Classification:
    WATCOM

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson