gbuffer_set_rd_offset()

gbuffer_set_rd_offset()#

Sets the read offset of the given gbuffer_t instance to the specified position, ensuring it does not exceed the allocated data size or the current write position.

Prototype

int gbuffer_set_rd_offset(
    gbuffer_t *gbuf,
    size_t     position
);

Parameters

Key

Type

Description

gbuf

gbuffer_t *

Pointer to the gbuffer_t instance whose read offset is to be set.

position

size_t

The new read offset position within the buffer.


Return Value

Returns 0 on success. Returns -1 if the specified position exceeds the allocated data size or the current write position.

Notes

If position is greater than the allocated data size or the current write position, an error is logged and -1 is returned.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples