Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

atol(3) [osx man page]

ATOL(3) 						   BSD Library Functions Manual 						   ATOL(3)

NAME
atol, atoll, atol_l, atoll_l -- convert ASCII string to long or long long integer LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> long atol(const char *str); long long atoll(const char *str); #include <xlocale.h> long atol_l(const char *str, locale_t loc); long long atoll_l(const char *str, locale_t loc); DESCRIPTION
The atol() function converts the initial portion of the string pointed to by str to long integer representation. It is equivalent to: strtol(str, (char **)NULL, 10); The atoll() function converts the initial portion of the string pointed to by str to long long integer representation. It is equivalent to: strtoll(str, (char **)NULL, 10); While the atol() and atoll() functions use the current locale, the atol_l() and atoll_l() functions may be passed locales directly. See xlocale(3) for more information. IMPLEMENTATION NOTES
The atol(), atoll(), atol_l(), and atoll_l() functions are thread-safe and async-cancel-safe. The FreeBSD implementations of the atol() and atoll() functions are thin wrappers around strtol() and stroll() respectively, so these func- tions will affect the value of errno in the same way that the strtol() and stroll() functions are able to. This behavior of atol() and atoll() is not required by ISO/IEC 9899:1990 (``ISO C90'') or ISO/IEC 9899:1999 (``ISO C99''), but it is allowed by all of ISO/IEC 9899:1990 (``ISO C90''), ISO/IEC 9899:1999 (``ISO C99'') and IEEE Std 1003.1-2001 (``POSIX.1''). ERRORS
The functions atol() and atoll() may affect the value of errno on an error. SEE ALSO
atof(3), atoi(3), strtod(3), strtol(3), strtoul(3), xlocale(3) STANDARDS
The atol() function conforms to ISO/IEC 9899:1990 (``ISO C90''). The atoll() function conforms to ISO/IEC 9899:1999 (``ISO C99''). BSD
February 1, 2009 BSD

Check Out this Related Man Page

ATOL(3P)						     POSIX Programmer's Manual							  ATOL(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
atol, atoll - convert a string to a long integer SYNOPSIS
#include <stdlib.h> long atol(const char *str); long long atoll(const char *nptr); DESCRIPTION
The call atol(str) shall be equivalent to: strtol(str, (char **)NULL, 10) The call atoll(str) shall be equivalent to: strtoll(nptr, (char **)NULL, 10) except that the handling of errors may differ. If the value cannot be represented, the behavior is undefined. RETURN VALUE
These functions shall return the converted value if the value can be represented. ERRORS
No errors are defined. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
The atol() function is subsumed by strtol() but is retained because it is used extensively in existing code. If the number is not known to be in range, strtol() should be used because atol() is not required to perform any error checking. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
strtol(), the Base Definitions volume of IEEE Std 1003.1-2001, <stdlib.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 ATOL(3P)
Man Page