with-mapped-array-reader ( path c-type quot -- ) (original) (raw)

with-mapped-array-reader ( path c-type quot -- )
Memory-mapped files

Prev: with-mapped-array ( path c-type quot -- )
Next: Working with memory-mapped data

Vocabulary
io.mmap

Inputs

path a pathname string
c-type a c-type
quot a quotation

Outputs
None

Word description
Memory-maps a file for reading as a mapped-array of the given c-type. The mapped file is disposed of when the quotation returns, or if an error is thrown.

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

Definition

USING: io.mmap.private kernel ;

IN: io.mmap

: with-mapped-array-reader ( path c-type quot -- )
[ ] 2dip (with-mapped-array) ; inline