BSON_ASCII_STRTOLL(3)

πŸ’– BSON_ASCII_STRTOLL(3) β€” the libbson bestie guide πŸ’–

okay so this is the libbson page for bson_ascii_strtoll, and it's basically the portable-queen version of strtoll(). Let's get into it, bestie. 🫢

🌸 SYNOPSIS 🌸

int64_t
bson_ascii_strtoll (const char *str, char **endptr, int base);

πŸŽ€ PARAMETERS πŸŽ€

  • str β€” the string you're converting, periodt.
  • endptr β€” address of the first invalid character of str, or null. Yes, it's a pointer-to-pointer situation, iykyk.
  • base β€” the base to use for the conversion.

✨ DESCRIPTION ✨

It's a portable version of strtoll(). Iconic.

It converts a string to a 64-bit signed integer according to the given base, which must be 16, 10, or 8. Leading whitespace will be ignored β€” not me ignoring your texts, just whitespace. πŸ’…

If you pass in base as 0, the base is inferred from the string's leading characters. Here's the tea:

  • Base-16 numbers start with "0x" or "0X".
  • Base-8 numbers start with "0".
  • Base-10 numbers start with a digit from 1 to 9.

If endptr is not NULL, it will be assigned the address of the first invalid character of str, or its null terminating byte if the entire string was valid.

If an invalid value is encountered, errno will be set to EINVAL and zero will be returned. If the number is out of range, errno is set to ERANGE and LLONG_MAX or LLONG_MIN is returned. So yeah, watch the range, bestie β€” that's the whole drama. 😭

πŸ’… RETURNS πŸ’…

The result of the conversion. Slay.

🫢 AUTHOR 🫢

MongoDB, Inc

2009-present, MongoDB, Inc.


Source/version: libbson 2.5.6 Β· date: Oct 09, 2026 β€” that's the whole page, bestie, go forth and convert πŸ’–

πŸ“¦ where this page comes from