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' specifies the base of 'value', which must be in
the range of 2-36. No overflow checking is performed.
Returns: A pointer to 'string'. There is no error return.
Notes: The space allocated for '*string' must be large enough to
hold the returned string, which can be up to 33 bytes.
-------------------------------- 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);
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster