HP-UX Reference (11i v3 07/02) - 3 Library Functions A-M (vol 6)
l
ltostr(3C) ltostr(3C)
NAME
ltostr(), ultostr(), ltoa(), ultoa() - convert long integers to strings
SYNOPSIS
#include <stdlib.h>
char *ltostr(long n, int base);
char *ultostr(unsigned long n, int base);
char *ltoa(long n);
char *ultoa(unsigned long n);
Obsolescent Interfaces
int ltostr_r(long n, int base, char *buffer, int buflen);
int ultostr_r(unsigned long n, int base, char *buffer, int buflen);
int ltoa_r(long n, char *buffer, int buflen);
int ultoa_r(unsigned long n, char *buffer, int buflen);
DESCRIPTION
ltostr() Convert a signed long integer to the corresponding string representation in the
specified base. The argument base must be between 2 and 36, inclusive.
ultostr() Convert an unsigned long integer to the corresponding string representation in the
specified base. The argument base must be between 2 and 36, inclusive.
ltoa() Convert a signed long integer to the corresponding base 10 string representation,
returning a pointer to the result.
ultoa() Convert an unsigned long integer to the corresponding base 10 string representation,
returning a pointer to the result.
These functions are smaller and faster than using sprintf() for simple conversions (see printf(3S)).
Obsolescent Interfaces
ltostr_r() , ultostr_r() , ltoa_r(), ultoa_r() convert long integers to strings.
ERRORS
If the value of base is not between 2 and 36, ltostr() and ultostr() return NULL and set the exter-
nal variable
errno to ERANGE.
WARNINGS
The return values for ltostr(), ultostr() , ltoa() and ultoa() point to data whose content is
overwritten by subsequent calls to these functions by the same thread.
ltostr_r() , ultostr_r() , ltoa_r() and ultoa_r() are obsolescent interface supported only
for compatibility with existing DCE applications. New multi-threaded applications should use
ltostr(),
ultostr(), ltoa() and ultoa().
AUTHOR
ltostr(), ultostr() , ltoa(), and ultoa() were developed by HP.
SEE ALSO
strtol(3C), printf(3S), thread_safety(5).
774 Hewlett-Packard Company − 1 − HP-UX 11i Version 3: February 2007