{"id":6872,"date":"2022-12-20T19:33:45","date_gmt":"2022-12-20T22:33:45","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/atoi-man3\/"},"modified":"2022-12-20T19:33:45","modified_gmt":"2022-12-20T22:33:45","slug":"atoi-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/atoi-man3\/","title":{"rendered":"ATOI (man3)"},"content":{"rendered":"<h1 align=\"center\">ATOI<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#ATTRIBUTES\">ATTRIBUTES<\/a><br \/> <a href=\"#CONFORMING TO\">CONFORMING TO<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#BUGS\">BUGS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COLOPHON\">COLOPHON<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">atoi, atol, atoll \u2212 convert a string to an integer<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <stdlib.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int atoi(const char *<\/b><i>nptr<\/i><b>); <br \/> long atol(const char *<\/b><i>nptr<\/i><b>); <br \/> long long atoll(const char *<\/b><i>nptr<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:5%; margin-top: 1em\">Feature Test Macro Requirements for glibc (see <b>feature_test_macros<\/b>(7)):<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>atoll<\/b>():<\/p>\n<p style=\"margin-left:17%;\">_ISOC99_SOURCE || <br \/> || \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var Glibc versions <= 2.19: bodies\/ usr\/ _BSD_SOURCE || _SVID_SOURCE<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>atoi<\/b>() function converts the initial portion of the string pointed to by <i>nptr<\/i> to <i>int<\/i>. The behavior is the same as<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">strtol(nptr, NULL, 10);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">except that <b>atoi<\/b>() does not detect errors.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>atol<\/b>() and <b>atoll<\/b>() functions behave the same as <b>atoi<\/b>(), except that they convert the initial portion of the string to their return type of <i>long<\/i> or <i>long long<\/i>.<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The converted value or 0 on error.<\/p>\n<h2>ATTRIBUTES <a name=\"ATTRIBUTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">For an explanation of the terms used in this section, see <b>attributes<\/b>(7).<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"7%\"> <\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"62%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"62%\"> <\/td>\n<\/tr>\n<\/table>\n<p align=\"center\"><img decoding=\"async\" src=\"grohtml-1574501.png\" alt=\"Image grohtml-1574501.png\"><\/p>\n<h2>CONFORMING TO <a name=\"CONFORMING TO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">POSIX.1-2001, POSIX.1-2008, C99, SVr4, 4.3BSD. C89 and POSIX.1-1996 include the functions <b>atoi<\/b>() and <b>atol<\/b>() only.<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">POSIX.1 leaves the return value of <b>atoi<\/b>() on error unspecified. On glibc, musl libc, and uClibc, 0 is returned on error.<\/p>\n<h2>BUGS <a name=\"BUGS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>errno<\/i> is not set on error so there is no way to distinguish between 0 as an error and as the converted value. No checks for overflow or underflow are done. Only base-10 input can be converted. It is recommended to instead use the <b>strtol<\/b>() and <b>strtoul<\/b>() family of functions in new programs.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>atof<\/b>(3), <b>strtod<\/b>(3), <b>strtol<\/b>(3), <b>strtoul<\/b>(3)<\/p>\n<h2>COLOPHON <a name=\"COLOPHON\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This page is part of release 5.10 of the Linux <i>man-pages<\/i> project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https:\/\/www.kernel.org\/doc\/man\u2212pages\/.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  atoi, atol, atoll \u2212 convert a string to an integer <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[2538,1709,3007],"class_list":["post-6872","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-atoi","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6872"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6872\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}