---
name: "bson_oid_init_from_string"
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_oid_init_from_string"
---

# bson\_oid\_init\_from\_string(3)

## SYNOPSIS

```
void
bson_oid_init_from_string (bson_oid_t *oid, const char *str);
```

## PARAMETERS

- •

  **oid**: A *bson\_oid\_t*.

- •

  **str**: A string containing a hex encoded version of the oid.

## DESCRIPTION

Parses the string containing hex encoded oid and initialize the bytes in **oid**.

## EXAMPLE

```
bson_oid_init_from_string (&oid, "012345678901234567890123");
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
