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>ultoa() convert unsigned long to string</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ultoa()                 Convert Unsigned Long to String

 #include   <stdlib.h>                   Required for declarations only

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

    ultoa() converts 'value' to a null-terminated string stored at
    'string'.  'radix', which must be in the range 2 thru 36, specifies
    the base of 'value'.  There is no overflow checking.

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

      Notes:    ultoa() returns up to 33 bytes. The space allocated for
                'string' must be large enough to hold the returned
                string.

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

    The following statements convert an unsigned long integer value into
    a string, using base 16, and print the result.

           #include <stdlib.h>

           unsigned long val = 615584;
           int radix = 16;
           char buffer[40];
           char *p;

           main()
           {
               p = ultoa(val,buffer,radix);
               printf("the hexadecimal representation of %ld is
                       %s\n",val,p);
           }


See Also: itoa() ltoa()

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