Scheme input and output can be read from or collected into a string:
String input and output ports do not need to be explicitly closed. The file-position procedure, described in section 11.1.5, works specially for string ports.
Example:
(define i (open-input-string "hello world"))
(define o (open-output-string))
(write (read i) o)
(get-output-string o) ; => "hello"