The strtol(3) and strtoul(3) Functions

The function sscanf(3) calls upon the functions strtol(3) and strtoul(3) to carry out its dirty work. You can go right to the source by calling them. The synopses for strtol(3) and strtoul(3) are as follows:

#include <stdlib.h>
#include <limits.h>

long strtol(const char *nptr, char **endptr, int base);

unsigned long strtoul(const char *nptr, char **endptr, int base);

Macros from <limits.h> :

The function strtol(3) converts a possibly signed integer within a character string to a long integer data type value. The function strtoul(3) is functionally identical, except that no sign is permitted, and the returned conversion value is an unsigned ...

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.