Borland C++ reference

ltoa

raw OCR

Converts a long to a string.

Defined in header <stdlib.h>

Syntax

#include <stdlib.h>
char *ltoa(long value, char *string, int radix);

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

Itoa converts value to a null-terminated string and stores the result in string, value is a long integer.

radix specifies the base to be used in converting value; it must be between 2 and 36, inclusive. If value is negative and radix is 10, the first character of string is the minus sign (-).

kl^

The space allocated for string must be large enough to hold the returned string, including the terminating null character (\0). Itoa can return up to 33 bytes.

Return value

Itoa returns a pointer to string.

See also

Example

#include <stdlib.h>
#include <stdio.h>

int main (void)
{
   char string [25];
   long value = 123456789L;
   Itoa (value,string,10),•
   printf("number  = lid  string = ls\n", value, string);
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.

Extraction notes

  • heading `Itoa` read as `ltoa`