home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 168.img / ACAD3.ZIP / FPRINT.LSP < prev    next >
Lisp/Scheme  |  1988-05-25  |  585b  |  19 lines

  1. ;  This is a programming example.
  2. ;  This function prints (lists) an ASCII text file on the screen.
  3. ;  Usage:   (fprint "filename.ext")
  4.          
  5. (defun fprint (s / c i)
  6.    (setq i (open s "r"))               ; open the file for reading
  7.    (if i
  8.       (progn
  9.          (while (setq c (read-line i)) ; read one line of text from the file
  10.             (princ c)                  ; and print it on the screen
  11.             (princ "\n")
  12.          )
  13.          (close i)                     ; close the file
  14.       )
  15.       (princ (strcat "Cannot open file " s))
  16.    )
  17.    (princ)
  18. )
  19.