dmi_reader_mark

Synopsis

#include <opendmi/reader.h>

dmi_reader_mark_t dmi_reader_mark(const dmi_reader_t *reader);

Description

The dmi_reader_mark function takes a mark of the current position of the reader cursor.

Marks name a place to come back to without counting the bytes read in between, which is what records of a declared length need: mark the beginning of the record, read whatever fields it holds, then rewind with dmi_reader_rewind, or step over the record by its length with dmi_reader_skip_ex.

Marks are values: they are copied rather than allocated, nest without any bookkeeping, and need no release. A mark stays valid for as long as the reader reads the same range of the same buffer.

Parameters

reader

Reader to mark.

Return value

Mark of the current position, which is rejected by dmi_reader_rewind if reader is nullptr.

Errors

None.