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


Vocabulary
io.mmap

Inputs and outputs
patha pathname string
c-typea c-type
quota quotation


Word description
Memory-maps a file for reading and writing, wrapping it in a specialized array with the given element type. The mapped file is disposed of when the quotation returns, or if an error is thrown.

Examples
USING: alien.c-types io.mmap prettyprint specialized-arrays ; SPECIALIZED-ARRAY: uint "resource:license.txt" uint [ [ . ] each ] with-mapped-array


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

Definition
USING: io.mmap.private kernel ;

IN: io.mmap

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