Library Version 12.1.6.0

DB_STREAM->read()
Prev | Chapter 13. Binary Large Objects | Next

## DB_STREAM->read()

    #include <db.h>

    int
    DB_STREAM->read(DB_STREAM *dbs, DBT *data, db_off_t offset,
                    u_int32_t size, u_int32_t flags);

The `DB_STREAM->read()` method reads size bytes from the BLOB, starting at offset, into the DBT data.

The stream is created using DBC->db_stream().

Unless otherwise specified, the `DB_STREAM->read()` method returns a non-zero error value on failure and 0 on success.

### Parameters

#### data

The data parameter is the DBT into which you want to place the data read using this method.

Note that the data DBT must be set with one of the following flags, or this method will return an error: DB_DBT_MALLOC, DB_DBT_REALLOC, DB_DBT_USERMEM, or DB_DBT_APPMALLOC.

#### offset

The offset parameter indicates the starting position, in bytes, from the beginning of the BLOB where you want the read to begin.

#### size

The size parameter indicates the number of bytes to read.

#### flags

The flags parameter must be set to 0.

### Errors

The `DB_STREAM->read()` method may fail and return one of the following non-zero errors:

#### DB_BUFFER_SMALL

The DBT provided to this method was not configured appropriately, and so there is not enough space allocated for the bytes you are trying to read.

#### EINVAL

An invalid flag value or parameter was specified; or if the DBT was configured with DB_DBT_PARTIAL.

### Class

DB_STREAM

### See Also

BLOBs and Related Methods

Prev | Up | Next
DB_STREAM->close() | Home | DB_STREAM->size()