strtol.3: EXAMPLES: As the default base, use special value 0

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2020-10-28 10:33:07 +01:00 committed by Michael Kerrisk
parent d01c330357
commit b924e6b65a
1 changed files with 1 additions and 1 deletions

View File

@ -269,7 +269,7 @@ main(int argc, char *argv[])
}
str = argv[1];
base = (argc > 2) ? atoi(argv[2]) : 10;
base = (argc > 2) ? atoi(argv[2]) : 0;
errno = 0; /* To distinguish success/failure after call */
val = strtol(str, &endptr, base);