1ATOL(3P) POSIX Programmer's Manual ATOL(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 atol, atoll - convert a string to a long integer
13
15 #include <stdlib.h>
16
17 long atol(const char *str);
18 long long atoll(const char *nptr);
19
20
22 The call atol(str) shall be equivalent to:
23
24
25 strtol(str, (char **)NULL, 10)
26
27 The call atoll(str) shall be equivalent to:
28
29
30 strtoll(nptr, (char **)NULL, 10)
31
32 except that the handling of errors may differ. If the value cannot be
33 represented, the behavior is undefined.
34
36 These functions shall return the converted value if the value can be
37 represented.
38
40 No errors are defined.
41
42 The following sections are informative.
43
45 None.
46
48 The atol() function is subsumed by strtol() but is retained because it
49 is used extensively in existing code. If the number is not known to be
50 in range, strtol() should be used because atol() is not required to
51 perform any error checking.
52
54 None.
55
57 None.
58
60 strtol(), the Base Definitions volume of IEEE Std 1003.1-2001,
61 <stdlib.h>
62
64 Portions of this text are reprinted and reproduced in electronic form
65 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
66 -- Portable Operating System Interface (POSIX), The Open Group Base
67 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
68 Electrical and Electronics Engineers, Inc and The Open Group. In the
69 event of any discrepancy between this version and the original IEEE and
70 The Open Group Standard, the original IEEE and The Open Group Standard
71 is the referee document. The original Standard can be obtained online
72 at http://www.opengroup.org/unix/online.html .
73
74
75
76IEEE/The Open Group 2003 ATOL(3P)