---
name: "bson_reader_read_func_t"
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_reader_read_func_t"
---

# bson\_reader\_read\_func\_t(3)

## SYNOPSIS

```
typedef ssize_t (*bson_reader_read_func_t) (void *handle,
                                            void *buf,
                                            size_t count);
```

## PARAMETERS

- •

  **handle**: The handle to read from.

- •

  **buf**: The buffer to read into.

- •

  **count**: The number of bytes to read.

## DESCRIPTION

A callback function that will be called by *bson\_reader\_t* to read the next chunk of data from the underlying opaque file descriptor.

This function is meant to operate similar to the **[read(2)](/read/2.md)** function as part of libc on UNIX-like systems.

## RETURNS

0 for end of stream.

\-1 for a failure on read.

A value greater than zero for the number of bytes read into **buf**.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
