On Sat, Jun 16, 2001 at 04:17:38PM -0700, Peter Ajamian came up with this idea: > "Daniel A. Koepke" wrote: > > > > strtoul() works for unsigned long int, not unsigned long long int. Thus, > > strtoul() probably won't work. > > C99 has strtoull() and probably most earlier implementations with an > unsigned long long type do also. That would work. > Just put in gcc3.0 and yup, works fine (as long as you remember to fill in all of the fields) for some sick, twisted reason I had a version of 2.95 that didn't want to use c99. (And oddly enough, 3.0 took about 28k off the size of the compiled mud) $ cat test.c #include <stdio.h> #include <stdlib.h> int main() { unsigned long long int to; char *from="-1"; to = strtoull(from, NULL, 10); /* for some reason mine don't figure out the fields itself, and stays undefined eventhough it's in stdlib.h no biggie */ printf("size: %d %#x %Lu %Ld %ld %lu %u %d\n", sizeof(to), to, to, to, to, to, to, to); exit(0); } $ gcc -std=c99 -Wall -o test test.c test.c: In function `main': test.c:10: warning: implicit declaration of function `strtoull' test.c:12: warning: unsigned int format, different type arg (arg 3) test.c:12: warning: long int format, different type arg (arg 6) test.c:12: warning: long unsigned int format, different type arg (arg 7) test.c:12: warning: unsigned int format, different type arg (arg 8) test.c:12: warning: int format, different type arg (arg 9) $ ./test size: 8 0xffffffff 18446744073709551615 -1 -1 4294967295 4294967295 -1 -mike -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/05/01 PST