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

Prev:<mapped-file> ( path -- mmap )
Next:with-mapped-file-reader ( path quot -- )


Vocabulary
io.mmap

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


Outputs
None

Generic word contract
Opens a file for read/write 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.

Notes
This is a low-level word, because mapped-file objects simply expose their base address and length. Most applications should use Working with memory-mapped data instead.

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

Definition