1ATOI(3)                    Linux Programmer's Manual                   ATOI(3)
2
3
4

NAME

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

SYNOPSIS

9       #include <stdlib.h>
10
11       int atoi(const char *nptr);
12       long atol(const char *nptr);
13       long long atoll(const char *nptr);
14       long long atoq(const char *nptr);
15
16   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18       atoll():
19           _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
20           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
21           or cc -std=c99
22

DESCRIPTION

24       The atoi() function converts the initial portion of the string  pointed
25       to by nptr to int.  The behavior is the same as
26
27           strtol(nptr, NULL, 10);
28
29       except that atoi() does not detect errors.
30
31       The atol() and atoll() functions behave the same as atoi(), except that
32       they convert the initial portion of the string to their return type  of
33       long or long long.  atoq() is an obsolete name for atoll().
34

RETURN VALUE

36       The converted value.
37

CONFORMING TO

39       SVr4,  POSIX.1-2001,  4.3BSD,  C99.   C89  and POSIX.1-1996 include the
40       functions atoi() and atol() only.  atoq() is a GNU extension.
41

NOTES

43       The nonstandard atoq() function is not present in libc 4.6.27 or  glibc
44       2, but is present in libc5 and libc 4.7 (though only as an inline func‐
45       tion in <stdlib.h> until libc 5.4.44).  The atoll() function is present
46       in glibc 2 since version 2.0.2, but not in libc4 or libc5.
47

SEE ALSO

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

COLOPHON

52       This  page  is  part of release 3.53 of the Linux man-pages project.  A
53       description of the project, and information about reporting  bugs,  can
54       be found at http://www.kernel.org/doc/man-pages/.
55
56
57
58GNU                               2012-08-03                           ATOI(3)
Impressum