[Linux manuál]
Návod, kniha: POSIX Programmer's Manual
long strtol(const char *restrict str, char
**restrict endptr, int
base );
long long strtoll(const char *restrict str, char
**restrict endptr,
int
base)
strtol, strtoll: převést řetězec na dlouhé celé číslo
Originální popis anglicky: strtol, strtoll - convert a string to a long integerNávod, kniha: POSIX Programmer's Manual
STRUČNĚ
#include <stdlib.h>POPIS / INSTRUKCE
These functions shall convert the initial portion of the string pointed to by str to a type long and long long representation, respectively. First, they decompose the input string into three parts:- 1.
- An initial, possibly empty, sequence of white-space characters (as specified by isspace())
- 2.
- A subject sequence interpreted as an integer represented in some radix determined by the value of base
- 3.
- A final string of one or more unrecognized characters, including the terminating null byte of the input string.
NÁVRATOVÁ HODNOTA
Upon successful completion, these functions shall return the converted value, if any. If no conversion could be performed, 0 shall be returned and errno may be set to [EINVAL]. If the correct value is outside the range of representable values, {LONG_MIN}, {LONG_MAX}, {LLONG_MIN}, or {LLONG_MAX} shall be returned (according to the sign of the value), and errno set to [ERANGE].CHYBY / ERRORY
These functions shall fail if:- ERANGE
- The value to be returned is not representable.
- EINVAL
- The value of base is not supported.
PŘÍKLADY POUŽITÍ
None.APPLICATION USAGE
None.RATIONALE
None.FUTURE DIRECTIONS
None.SOUVISEJÍCÍ
isalpha() , scanf() , strtod() , the Base Definitions volume of IEEE Std 1003.1-2001, <stdlib.h>COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .| 2003 | IEEE/The Open Group |