with-mapped-file-reader ( path quot -- )
Memory-mapped files

Prev:with-mapped-file ( path quot -- )
Next:with-mapped-array ( path c-type quot -- )


Inputs and outputs
patha pathname string
quota quotation with stack effect ( mmap -- )

Generic word contract
Opens a file for read-only access and maps its contents into memory, passing the mapped-file instance to the quotation. The mapped file is disposed of when the quotation returns, or if an error is thrown.

This is a low-level word, because mapped-file objects simply expose their base address and length. See Working with memory-mapped data for a discussion of how to access data in a mapped file.

Throws an error if a memory mapping could not be established.