folly::preadFull

Like readFull but reads at a given offset.

Synopsis

Declared in <folly/FileUtil.h>

[[nodiscard]]
ssize_t
preadFull(
    int fd,
    void* buf,
    size_t count,
    off_t offset);

Return Value

The number of bytes read, or -1 on error.

NOTE

The return value should not be discarded.

Parameters

NameDescription
fdThe file descriptor to read from.
bufDestination buffer.
countNumber of bytes to read.
offsetFile offset to read from.