The libc implementation
Martin ‘Solar’ Baute
Public Domain
strtol.c | The libc implementation |
Functions | |
strtol | Converts a string in s to an long. |
Todo’s | |
These tests assume two-complement, but conversion should work | |
test “odd” overflow, i. e. base is not power of two | |
test “odd” overflow, i. e. base is not power of two |
long int strtol( const char * s, char ** endptr, int base )
Converts a string in s to an long.
A nonzero base can be supplied to force a specific radix.
endptr can be supplied in order to get a pointer to the remainder of the string.
Returns the value in the string if present, clamped to the maximum on overflow
Returns 0 if the string isn’t a number
Converts a string in s to an long.
long int strtol( const char * s, char ** endptr, int base )