with-stream ( stream quot -- )
Factor documentation > Factor handbook > Input and output > Duplex streams
Prev:<duplex-stream> ( in out -- duplex-stream )
Next:with-stream* ( stream quot -- )


Vocabulary
io.streams.duplex

Inputs and outputs
streama duplex-stream
quota quotation


Word description
Calls the quotation in a new dynamic scope, with both input-stream and output-stream rebound to stream, which must be a duplex stream. The stream is closed if the quotation returns or throws an error.

Definition
USING: io kernel ;

IN: io.streams.duplex

: with-stream ( stream quot -- )
[ >duplex-stream< ] dip with-streams ; inline