Convert strings of ASCII characters to the appropriate numeric
values. strtoll is a synonym for strtoq.
This function is supported on OpenVMS Integrity servers and
Alpha only.
Format
#include <stdlib.h>
__int64 strtoq (const char *nptr, char **endptr, int base);
__int64 strtoll (const char *nptr, char **endptr, int base);
1 – Function Variants
These functions have variants named _strtoq32, _strtoll32 and
_strtoq64, _strtoll64 for use with 32-bit and 64-bit pointer
sizes, respectively.
2 – Arguments
nptr
A pointer to the character string to be converted to an __int64.
endptr
The address of an object where the function can store a pointer
to the first unrecognized character encountered in the conversion
process (that is, the character that follows the last character
in the string being converted). If endptr is a NULL pointer, the
address of the first unrecognized character is not retained.
base
The value, 2 through 36, to use as the base for the conversion.
3 – Description
The strtoq and strtoll functions recognize strings in various
formats, depending on the value of the base. Any leading white-
space characters (as defined by isspace in <ctype.h>) in the
given string are ignored. The functions recognize an optional
plus or minus sign, then a sequence of digits or letters that may
represent an integer constant according to the value of the base.
The first unrecognized character ends the conversion.
Leading zeros after the optional sign are ignored, and 0x or 0X
is ignored if the base is 16.
If base is 0, the sequence of characters is interpreted by
the same rules used to interpret an integer constant: after
the optional sign, a leading 0 indicates octal conversion, a
leading 0x or 0X indicates hexadecimal conversion, and any other
combination of leading characters indicates decimal conversion.
The function call atoq (str) is equivalent to strtoq (str,
(char**)NULL, 10).
4 – Return Values
x The converted value.
__INT64_MAX or Indicates that the converted value would cause
__INT64_MIN an overflow.
0 Indicates that the string starts with an
unrecognized character or that the value for
base is invalid. If the string starts with
an unrecognized character, *endptr is set to
nptr.