STRTOL(3)

NAME
strtol, strtoll, strtoul, strtoull - convert string to number

SYNOPSIS
#include <stdlib.h>
long strtol(const char *nptr, char **endptr, int base);
unsigned long strtoul(const char *nptr, char **endptr, int base);
#ifdef __LONG_LONG_SUPPORTED
long long strtoll(const char *nptr, char **endptr, int base);
unsigned long long strtoull(const char *nptr, char **endptr, int base);
#endif

DESCRIPTION
These functions parse as much from the string nptr as possible and return it as an integer. The string should consist of any number of whitespace characters followed by a sign (either plus or minus) and at least one digit in the specified base. The digits of a hexadecimal string may be preceded by the prefix 0x or 0X, which is ignored. If base is zero, hexadecimal is assumed if this prefix is present, octal is assumed if there is a leading zero and decimal is assumed otherwise. If not zero, base must be at least 2 and at most 36. A pointer to the first character following the numeric string is stored in *endptr.

Note that the strtoll and strtoull functions, which return 64-bit values, are supported only on GCC as ACK does not support 64-bit arithmatic.

RETURN VALUE
The parsed number is returned.

SEE ALSO
atoi(3).