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