Documentation
Return the contents of PATHNAME as a string.
Source
(defun read-string-from-file (pathname &key (buffer-size 4096)
(element-type 'character))
"Return the contents of PATHNAME as a string."
(with-input-from-file (file-stream pathname)
(with-output-to-string (datum)
(let ((buffer (make-array buffer-size :element-type element-type)))
(loop for bytes-read = (read-sequence buffer file-stream)
do (write-sequence buffer datum :start 0 :end bytes-read)
while (= bytes-read buffer-size))))))
Source Context