Macro: WITH-INPUT-FROM-FILE

Documentation

Evaluate BODY with STREAM-NAME bound to an input-stream from file FILE-NAME. ARGS is passed directly to open.

Source

(defmacro with-input-from-file ((stream-name file-name &rest args) &body body)
  "Evaluate BODY with STREAM-NAME bound to an
  input-stream from file FILE-NAME. ARGS is passed
  directly to open."
  (when (member :direction args)
    (error "Can't specifiy :DIRECTION in WITH-INPUT-FILE."))
  `(with-open-file (,stream-name ,file-name :direction :input ,@args)
     ,@body))
Source Context