Name
ltoa - Converts a long integer to a string.
Syntax
#include <stdlib.h>
char *ltoa(value, string, radix)
long value;
char *string;
int radix;
Description
The ltoa function converts the digits of value to a null-
terminated character string and stores the result (up to 33
bytes) in string. The radix argument specifies the base of
value; it must be in the range 2 - 36. If radix equals 10
and value is negative, the first character of the stored
string is the minus sign (-).
Return Value
The ltoa function returns a pointer to string. There is no
error return.
See Also
itoa(DOS), ultoa(DOS)
Example
#include <stdlib.h>
int radix = 10; char buffer[20]; char *p; main() {
/* p = "-344115" */
p = ltoa(-344115L,buffer,radix);
printf( "Buffer= \%s\\n", buffer ); }
This program displays the long integer -344,115 as a base-10
string.
(printed 6/18/89)