#include <stdlib.h>
long strtol (
const char *s,
char **endp
)
|
Arguments
s |
Pointer to a character string |
endp |
Pointer to a storage area that will contain a pointer to the character
that stopped the conversion |
Return Value
The result of converting the character string pointed to by s to
an integer is returned if the conversion was successful. 0 is returned
if an error occurred.
Explanation
The character string pointed to by s is converted to an integer
and its value is returned. Note that long and int are declared as the same
type in the R3000. The string pointed to by s must be in one of
the following formats: [ws][sn][ddd]
[ws] |
White space (can be omitted) |
[sn] |
Sign (can be omitted) |
[ddd] |
Number string (can be omitted) |
strtol() stops conversion when a character is encountered that cannot
be converted. A pointer to the character that terminated the conversion
is placed at the storage location specified by endp unless endp
is NULL.
See Also
strtoul()
|