strtoull.c 263 B

1234567891011121314
  1. #include <stdlib.h>
  2. #include <inttypes.h>
  3. #include <errno.h>
  4. #include <limits.h>
  5. unsigned long long strtoull(const char *s, char **p, int base)
  6. {
  7. uintmax_t x = strtoumax(s, p, base);
  8. if (x > ULLONG_MAX) {
  9. errno = ERANGE;
  10. return ULLONG_MAX;
  11. }
  12. return x;
  13. }