1. Home
  2. Computing & Technology
  3. Focus on Linux
Linux / Unix Command: atoll
Command Library

NAME

atoi, atol, atoll, atoq - convert a string to an integer.  

SYNOPSIS

#include <stdlib.h>

int atoi(const char *nptr);

long atol(const char *nptr);
long long atoll(const char *nptr);
long long atoq(const char *nptr);
 

DESCRIPTION

The atoi() function converts the initial portion of the string pointed to by nptr to int. The behaviour is the same as

strtol(nptr, (char **)NULL, 10);

except that atoi() does not detect errors.

The atol() and atoll() functions behave the same as atoi(), except that they convert the initial portion of the string to their return type of long or long long. atoq() is an obsolete name for atoll().  

RETURN VALUE

The converted value.  

CONFORMING TO

SVID 3, POSIX.1, BSD 4.3, ISO/IEC 9899. ISO/IEC 9899:1990 (C89) and POSIX.1 (1996 edition) include the functions atoi() and atol() only; C99 adds the function atoll().  

SEE ALSO

atof(3), strtod(3), strtol(3), strtoul(3)


Important: Use the man command (% man) to see how a command is used on your particular computer.

>> Linux/Unix Command Library

>> Shell Command Library

Explore Focus on Linux

More from About.com

  1. Home
  2. Computing & Technology
  3. Focus on Linux

©2008 About.com, a part of The New York Times Company.

All rights reserved.