|
||
long strtol( char *s, char **p, int base )
char *s; /* input string */ char **p; /* address of char pointer to receive last parse position */ int base; /* integer base */
|
|
|
Synopsis |
#include "stdlib.h"
The strtol function attempts to convert the prefix of the string s into a long int, and returns that value. If p is not NULL , then a pointer to the location in s where the conversion left off is stored into the character pointer at p . Leading spaces in s are skipped. The interpretation of s is affected by base : if it is zero, then the number should be formatted as a decimal, hexadecimal or octal constant (as in C); if it is between 2 and 36, inclusive, then the number must be formatted as a non-empty sequence of letters and digits in that base (with the letters 'a' ..'z' or 'A' ..'Z' representing digits for 10..36). Leading '+' or '-' signs are allowed.
|
|
Parameters |
s is a null-terminated string. *p is the address of a character pointer that is to receive the ending position of the parse. base is an integer that specifies the numeric base in which the convsion is to occur.
|
|
Return Value |
strtol returns the long integer converted. If the number would overflow, a range error is generated.
|
|
See Also |
|
|
|
|