strtoll
- Updated2023-02-21
- 2 minute(s) read
strtoll
long long strtoll (const char stringInput[], char **endPointer, int base);
Purpose
Converts the initial portion of a string to a long long integer representation with a specified base. Whitespace characters at the beginning of the string are skipped. The conversion stops when the function reaches a character that cannot be part of the number. The function obtains a pointer to the unconverted part of the string.
Parameters
Input | ||||
Name | Type | Description | ||
stringInput | const char [] | A pointer to the character sequence from which a conversion is made. | ||
base | int |
The value of the radix that is used to make the appropriate conversion. If the base is zero, the expected form of the
subject sequence is that of an integer constant. If the value of the base is between 2 and 36, the expected form of the subject
sequence is a sequence of letters and digits representing an integer.
|
||
Output | ||||
Name | Type | Description | ||
endPointer | char * | A pointer to the first character in stringInput that cannot be part of the number converted. If the subject sequence is empty or does not have the expected form, the value of stringInput is stored in the object pointed to by this parameter. Pass NULL if you do not need the remainder. |
Return Value
Name | Type | Description |
convertedValue | long long | The converted value, if any. If no conversion is possible, the function returns zero. If the correct value is outside the range of representable values, strtoll returns LLONG_MAX or LLONG_MIN, according to the sign of the value, and sets errno to ERANGE. |
Additional Information
Library: ANSI C Library
Include file: ansi_c.h
LabWindows/CVI compatibility: LabWindows/CVI 8.5 and later
Example
Refer to compiler\c99extensions\c99extensions.cws for an example of using the strtoll function.