atol() — Convert character string to long

Format

#include <stdlib.h>

long int atol(const char *nptr);

General description

The atol() function converts the initial portion of the string pointed to by nptr to a 'long int'. This is equivalent to
strtol(nptr, (char **)NULL, 10)

Returned value

If successful, atol() returns the converted long int value represented in the string.

If unsuccessful, atol() returns an undefined value.

Related Information