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

Last change on this file since 32684 was 32684, checked in by sjamaan, 5 years ago

memory-mapped-files: Remove tempfile like we do in chicken core master

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