1 USING: tools.test io.files io.files.temp io io.streams.c
2 io.encodings.ascii strings destructors kernel specialized-arrays
3 alien.c-types math alien.data ;
8 "hello world" "test.txt" temp-file ascii set-file-contents
10 "test.txt" temp-file "rb" fopen <c-reader> stream-contents
15 [ "test.txt" temp-file "rb" fopen <c-reader> [ stream-tell ] [ dispose ] bi ] unit-test
18 "test.txt" temp-file "rb" fopen <c-reader>
19 3 over stream-read drop
20 [ stream-tell ] [ dispose ] bi
23 ! Writing specialized arrays to binary streams
25 "test.txt" temp-file "wb" fopen <c-writer> [
26 int-array{ 1 2 3 } write
30 [ int-array{ 1 2 3 } ] [
31 "test.txt" temp-file "rb" fopen <c-reader> [
37 ! Writing strings to binary streams should fail
39 "test.txt" temp-file "wb" fopen <c-writer> [