RAD Studio |  |

ltoa, _ltoa, _ltow

Header File

stdlib.h

Category

Conversion Routines, Math Routines

Prototype

char * ltoa(long value, char * string, int radix);

char *_ltoa(long value, char *string, int radix);

wchar_t *_ltow(long value, wchar_t *string, int radix);

Description

Converts a long to a string. _ltow is the unicode version. It converts a long to a wide-charater string.

Converts value to a null-terminated string and stores the result in string. value is a long.

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 (-).

Note: The space allocated for string must be large enough to hold the returned string, including the terminating null character (\0). Can return up to 33 bytes.
Return Value

Returns a pointer to string.

Example

Copy Code

    #include <stdlib.h>
    #include <stdio.h>
    int main(void)
    {
       char string[25];
       long value = 123456789L;
       ltoa(value,string,10);
       printf("number = %ld  string = %s\n", value, string);
       return 0;
    }

Portability

| POSIX | Win32 | ANSI C | ANSI C++
ltoa |  | + |  |
_ltoa |  | + |  |
_ltow |  | + |  |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!