gcvt()                   Convert Double to String
 
 #include   <stdlib.h>                   Required for declarations only
 
 char       gcvt(value,ndec,buffer);
 double     value;                       Value to be converted
 int        ndec;                        Number of significant digits stored
 char       *buffer;                     Storage location for results
 
    gcvt() converts the double 'value' to a character string and stores
    it in 'buffer'.  'buffer' should be large enough to store 'value'
    plus a terminating null character ('\0'), which is automatically
    appended.  gcvt() attempts to produce 'ndec' significant digits in
    FORTRAN F format or, if unsuccessful, FORTRAN E format.  Trailing
    zeros may be suppressed. There is no provision for overflow.
 
    Returns:    A pointer to the string of digits.  There is no error
                return.
 
  -------------------------------- Example ---------------------------------
 
    The following example converts a double value to a string and prints
    it out.
 
          #include <stdlib.h>
          char buffr[30];
          int declen = 6;
 
          main()
          {
               gcvt(12.9842,declen,buffr);
               printf("value: %s\n",buffr);
           }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster