Map a file section into read‐only memory.

Synopsis

Declared in <bdls_fdstreambuf.h>

void*
mmap(
    std::streamoff offset,
    std::streamoff length);

Description

Map to memory a section of the file starting at the specified offset from the start of the file and return a pointer to that memory. The section mapped is to be of the specified length. The behavior is undefined unless offset is a multiple of pageSize. Note that the memory is mapped for readonly access.

Return Value

pointer to the mapped read‐only memory

Parameters

Name

Description

offset

byte offset from the start of the file

length

length in bytes of the section to map

Created with MrDocs