In Shen, streams are used to read from or to files. The function to create a stream is (open string direction). string is a pathname to the file and direction is in for source and out for sink.

The primitive read and write functions for streams are read-byte and write-byte (see files and I/O in the fast reference). These read a byte from a source stream or print a string to a sink stream. close closes a stream.

(13-) (set *mystream* (open "gate-of-consciousness.ico" in)) {read a binary file}
#<INPUT BUFFERED FILE-STREAM (UNSIGNED-BYTE 8) #P"gate-of-consciousness.ico">
(14-) (read-byte (value *mystream*))
(15-) (read-byte (value *mystream*))
(16-) (read-byte (value *mystream*))
(17-) (close (value *mystream*))

Further Reading