Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>ltoa() convert long to string</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ltoa()                  Convert Long to String

 #include   <stdlib.h>                   Required for declarations only

 char       *ltoa(value,string,radix);
 long       value;                       Number to be converted
 char       *string;                     String result
 int        radix;                       Base of 'value'

    ltoa() converts the long 'value' to a null-terminated string stored
    in 'string'.  'radix' is the base to be used in converting 'value'
    and must be in the range 2 thru 36.  The first character of 'string'
    is a minus sign if 'value' is negative and 'radix' is 10.

    ltoa() returns a maximum of 33 bytes.  Enough space must be allocated
    to hold the returned string.

    Returns:    A pointer to 'string'; no error return.

 Portability:   Applies to MS DOS only.

   -------------------------------- Example ---------------------------------

    The following statements convert a long integer to a string and print
    the string.

           #include <stdlib.h>

           int radix = 10;
           char buffer[33];
           char *strptr;

           main()
           {
               strptr = ltoa(64000,buffer,radix);
               printf("The value is: %s\n",strptr);
           }




See Also: itoa() ultoa()

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