Adding WIP w/ gemini example.
This commit is contained in:
8
examples/gemini/slurp.fs
Normal file
8
examples/gemini/slurp.fs
Normal file
@ -0,0 +1,8 @@
|
||||
: slurp-file ( a n -- a n )
|
||||
r/o open-file throw >r
|
||||
r@ file-size throw ( sz )
|
||||
dup 1+ allocate throw swap ( data sz )
|
||||
2dup r@ read-file throw drop
|
||||
r> close-file throw
|
||||
2dup + 0 swap c!
|
||||
;
|
||||
Reference in New Issue
Block a user