rev: 3827f53bae88e48a594610914ba74b9512ead6dd tukan/testing/test_file.sc -rw-r--r-- 550 bytes View raw Log this file
3827f53bae88 — Leonard Ritter * more work on module system 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using import ..tukan.File


fn test-file ()
    do
        let f =
            try (File.open "test.tmp" "wb")
            except (err)
                print "error:" err
                return;
        print
            'write f ("test\n" as rawstring) 5
        print f
    do
        let f =
            try (File.open "test.tmp" "rb")
            except (err)
                print "error:" err
                return;
        local buf : (array i8 6)
        'read f &buf 5
        buf @ 5 = 0
        print "read:" (string &buf)

test-file;

;