|
NAMEstrtol , strtoll ,
strtoimax , strtoq —
convert a string value to a long,
long long, intmax_t or
quad_t integer
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <stdlib.h>
#include <limits.h>
long
long long
intmax_t
quad_t
DESCRIPTIONThestrtol () function converts the string in
nptr to a long value. The
strtoll () function converts the string in
nptr to a long long value. The
strtoimax () function converts the string in
nptr to an intmax_t value. The
strtoq () function converts the string in
nptr to a quad_t value. The
conversion is done according to the given base, which
must be between 2 and 36 inclusive, or be the special value 0.
The string may begin with an arbitrary amount of white space (as
determined by
isspace(3))
followed by a single optional ‘ The remainder of the string is converted to a
long, long long,
intmax_t or quad_t value in the
obvious manner, stopping at the first character which is not a valid digit
in the given base. (In bases above 10, the letter
‘ If endptr is not
RETURN VALUESThestrtol (), strtoll (),
strtoimax () and strtoq ()
functions return the result of the conversion, unless the value would
underflow or overflow. If no conversion could be performed, 0 is returned and
the global variable errno is set to
EINVAL (the last feature is not portable across all
platforms). If an overflow or underflow occurs, errno is
set to ERANGE and the function return value is clamped
according to the following table.
ERRORSSEE ALSOatof(3), atoi(3), atol(3), strtod(3), strtonum(3), strtoul(3), wcstol(3)STANDARDSThestrtol () function conforms to
ISO/IEC 9899:1990 (“ISO C90”).
The strtoll () and strtoimax ()
functions conform to ISO/IEC 9899:1999
(“ISO C99”). The BSD
strtoq () function is deprecated.
Visit the GSP FreeBSD Man Page Interface. |