add with-file-in with-file-out with-file-appender
parent
8428f66933
commit
2a417f4a9c
|
@ -169,3 +169,12 @@ PRIVATE>
|
||||||
|
|
||||||
: file-contents ( path -- str )
|
: file-contents ( path -- str )
|
||||||
dup <file-reader> swap file-length <sbuf> [ stream-copy ] keep >string ;
|
dup <file-reader> swap file-length <sbuf> [ stream-copy ] keep >string ;
|
||||||
|
|
||||||
|
: with-file-in ( path quot -- )
|
||||||
|
>r <file-reader> r> with-stream ; inline
|
||||||
|
|
||||||
|
: with-file-out ( path quot -- )
|
||||||
|
>r <file-writer> r> with-stream ; inline
|
||||||
|
|
||||||
|
: with-file-appender ( path quot -- )
|
||||||
|
>r <file-appender> r> with-stream ; inline
|
||||||
|
|
Loading…
Reference in New Issue