Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <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 an unsigned long integer, 'value', to a
    null-terminated string stored at 'string'.  The base used to convert
    'value' is specified by 'radix', which must be in the range 2 through
    36, inclusive.  No overflow checking is performed.

       Returns:     A pointer to 'string'.  There is no error return.

         Notes:     ultoa() returns up to 33 bytes including the
                    terminating NULL character.  The space allocated 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