Paste: why does it work just once?
Author: | benny99 |
Mode: | forth |
Date: | Sun, 28 Dec 2008 20:23:03 |
Plain Text |
s" testfile.txt" Value testfile
256 Constant max-line
Create line-buffer max-line 2 + allot
0 Value fd-in
0 Value fd-out
: open-input
r/o open-file throw to fd-in ;
: open-output
w/o create-file throw to fd-out ;
: close-input
fd-in close-file throw ;
: close-output
fd-out close-file throw ;
: read-some
line-buffer max-line fd-in read-line throw drop
line-buffer swap ;
: main
testfile open-input read-some type close-input ;
main
main
New Annotation