with-input-stream ( stream quot -- ) (original) (raw)

with-input-stream ( stream quot -- )
Factor handbook » Input and output » Streams » Default input and output streams

Prev: seek-input ( n seek-type -- )
Next: with-input-stream* ( stream quot -- )

Vocabulary
io

Inputs

stream an input stream
quot a quotation

Outputs
None

Word description
Calls the quotation in a new dynamic scope, with input-stream rebound to stream. The stream is closed if the quotation returns or throws an error.

See also
with-input-stream*

Definition

USING: destructors kernel ;

IN: io

: with-input-stream ( stream quot -- )
[ with-input-stream* ] curry with-disposal ; inline