(define (read-all-chars-as-string in-port)
(let ((out-port (open-string-port)))
(let loop ()
(if (char-ready? in-port)
(begin
(write-char (read-char in-port) out-port)
(loop))
(get-output-string out-port)))))