don't use passed end of file

This commit is contained in:
David Botton 2022-09-05 21:06:28 -04:00
parent 1f9d513252
commit ace126f678

View file

@ -183,9 +183,10 @@
"Read local file named INFILE"
(with-open-file (instream infile :direction :input :if-does-not-exist nil)
(when instream
(let ((string (make-string (file-length instream))))
(read-sequence string instream)
string))))
(let* ((len (file-length instream))
(string (make-string len))
(pos (read-sequence string instream)))
(subseq string 0 pos)))))
(defun write-file (string outfile &key (action-if-exists :rename))
"Write local file named OUTFILE"