> From: Mark H Weaver <m...@netris.org>

> 
> As shown in the upcase program above, (read-delimited "" port) will 
> read
> the whole file as a string.  You need to (use-modules (ice-9 rdelim)) to
> import this procedure.

Nice.  For reading entire files, I always ended up doing something like
the following (which does reveal how I think of everything in low-level C
constructs, I suppose.)

(use-modules (ice-9 rw))

(define (read-all port) (let loop ((block (make-string 32000))
(text ""))
    (let ((count (read-string!/partial block port)))
      (if count
          (loop block 
(string-append text (substring block 0 count)))
          text))))-Mike


Reply via email to