[<<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 and
stores it in 'string'. 'radix' specifies the base to be used in
converting 'value'; it must be in the range 2 - 36. If 'value' is
negative and 'radix' is 10, the first character of 'string' is a
minus sign (-).
Returns: A pointer to 'string'. There is no error return.
Notes: Enough space for 'string' must be allocated to hold the
returned string. ltoa() can return up to 33 bytes.
-------------------------------- 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()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson