Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>fcvt</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
fcvt

Usage

   #include <process.h>
   char *fcvt(double val,int nfrac,int *pdecpt,int *psign);

Description

   Converts the double value into a string and returns a pointer to that
   string. nfrac specifies the number of digits that appear after the
   decimal point. The digit string is rounded. The position of the decimal
   point relative to the left of the first digit in the string is stored in
   *pdecpt. If *pdecpt is negative, the decimal point is positioned that
   many places to the left of the string. Into *psign is stored 0 if val >=
   0, else a non-zero value. The string is written into a statically
   allocated area, shared with ecvt and printf, which is reused at each
   call.

Example 

   #include <stdio.h>

   #include <process.h>
   #include <stdlib.h>

   int main()
   {
       char *buffer;
       int dec, sign;
       buffer = fcvt(98.69138432, 5, &dec, &sign);
       printf("buffer = \"%s\", decimal = %d, sign = %d\n", buffer,dec,sign);
       return EXIT_SUCCESS;
   }

Return Value

   Returns a pointer to a static string of digits which is overwritten by
   each call to ecvt, fcvt or printf.

See Also

   ecvt, sprintf



See Also: ecvt sprintf

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