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

Last change on this file since 34718 was 34718, checked in by sjamaan, 19 months ago

release/5: Replace use by import in eggs

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