---
name: "bson_ascii_strtoll"
section: "3"
platform: "linux"
package: "libbson-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/bson_ascii_strtoll"
---

# bson\_ascii\_strtoll(3)

## SYNOPSIS

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

## PARAMETERS

- •

  **str**: The string to convert.

- •

  **endptr**: Address of the first invalid character of **str**, or null.

- •

  **base**: The base to use for the conversion.

## DESCRIPTION

A portable version of **strtoll()**.

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.

If base is 0 is passed in, the base is inferred from the string's leading characters. 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.

## RETURNS

The result of the conversion.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
