atol() — Convert character string to long

Standards

Standards / Extensions C or C++ Dependencies
ISO C
POSIX.1
XPG4
XPG4.2
C99
Single UNIX Specification, Version 3
both  

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

The atol() function returns the converted value if the value can be represented, otherwise the return value is undefined.

Related information