std::atoi, std::atol, std::atoll
From Cppreference
C++ Standard Library |
---|
Strings library |
Narrow null-terminated strings |
Defined in header <cstdlib>
|
||
int atoi( const char *str );
|
||
long atol( const char *str )
|
||
long long atoll( const char *str );
|
(C++11 feature) | |
Interprets an integer value in a character string pointed to by str.
Function discards any whitespace characters until first non-whitespace character is found. Then it takes as many characters as possible to form a valid integer number representation and converts them to integer value. The valid integer value consists of the following parts:
- (optional) plus or minus sign
- numeric digits
Contents |
[edit] Parameters
str | - | pointer to the null-terminated character string to be interpreted |
[edit] Return value
integer value corresponding to the contents of str on success. If the converted value falls out of range of corresponding return type, INT_MAX, INT_MIN, LONG_MAX, LONG_MIN, LLONG_MAX or LLONG_MIN is returned. If no conversion can be performed, 0 is returned.
This section is incomplete Reason: fix links to limits |
[edit] Example
This section is incomplete |
[edit] See also
|
converts a character string to an integer value (function) |
|
|
converts a character string to an unsigned integer value (function) |