source: project/release/5/memory-mapped-files/trunk/tests/run.scm

Last change on this file was 35504, checked in by Kooda, 2 years ago

Update CHICKEN 5's memory-mapped-files egg

File size: 631 bytes
Line 
1(import memory-mapped-files
2        (chicken blob)
3        (chicken file)
4        (chicken file posix)
5        (chicken memory))
6
7
8(let ((tnpfilpn (create-temporary-file)))
9  (let ((tmpfilno (file-open tnpfilpn (+ open/rdwr open/creat)))
10        (data "abcde")
11        (size 5))
12    (file-write tmpfilno data)
13    (let ((mmap (map-file-to-memory #f size prot/read (+ map/shared map/file) tmpfilno))
14          (str (make-string size)))
15      (move-memory! (memory-mapped-file-pointer mmap) str size)
16      (assert (blob=? (string->blob data) (string->blob str)))
17      (unmap-file-from-memory mmap)
18      (delete-file* tnpfilpn))))
Note: See TracBrowser for help on using the repository browser.