Date: Sun, 30 Jun 1996 16:53:21 -0700 (PDT) From: Archie Cobbs <archie@whistle.com> To: freebsd-questions@freebsd.org Subject: strtouq() Message-ID: <199606302353.QAA27875@bubba.whistle.com>
next in thread | raw e-mail | index | archive | help
Is this function strtouq() completely broken or am I doing something dumb ? Here's a test program... #include <sys/types.h> #include <stdlib.h> #include <limits.h> #include <stdio.h> #include <err.h> int main(int ac, char *av[]) { u_quad_t num; if (ac != 2) errx(1, "bad usage"); num = strtouq(av[1], NULL, 0); printf("Result: %s -> %qu\n", av[1], num); return(0); } It produces this output... $ strtouq 1234 Result: 1234 -> 1234 $ strtouq 4294967294 Result: 4294967294 -> 4294967294 $ strtouq 4294967296 Result: 4294967296 -> 18446744073709551615 $ strtouq 18446744073709551615 Result: 18446744073709551615 -> 18446744073709551615 $ strtouq 18446744073709551614 Result: 18446744073709551614 -> 18446744073709551615 Seems like it can't handle any value higher than 2^32 ? This happens on both 2.1 and -current. -Archie ___________________________________________________________________________ Archie L. Cobbs, archie@whistle.com * Whistle Communications Corporation
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606302353.QAA27875>