home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 5.img / R11SUPP.EXE / FPRINT.LSP < prev    next >
Encoding:
Lisp/Scheme  |  1990-07-30  |  1.3 KB  |  40 lines

  1. ;;; --------------------------------------------------------------------------;
  2. ;;; FPRINT.LSP
  3. ;;;   Copyright (C) 1990 by Autodesk, Inc.
  4. ;;;  
  5. ;;;   Permission to use, copy, modify, and distribute this software and its
  6. ;;;   documentation for any purpose and without fee is hereby granted.  
  7. ;;;
  8. ;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 
  9. ;;;   ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF 
  10. ;;;   MERCHANTABILITY ARE HEREBY DISCLAIMED.
  11. ;;;
  12. ;;; --------------------------------------------------------------------------;
  13. ;;; DESCRIPTION
  14. ;;;
  15. ;;;   This is a programming example.
  16. ;;;
  17. ;;;   This function prints (lists) an ASCII text file on the screen.
  18. ;;;
  19. ;;;   Usage:   (fprint "filename.ext")
  20. ;;;
  21. ;;; --------------------------------------------------------------------------;
  22.  
  23. (defun fprint (s / c i) 
  24.   (setq i (open s "r"))               ; open the file for reading
  25.   (if i 
  26.     (progn
  27.       (while (setq c (read-line i))   ; read one line of text from the file
  28.         (princ c)                     ; and print it on the screen
  29.         (princ "\n")
  30.       ) 
  31.       (close i)                       ; close the file
  32.     ) 
  33.     (princ (strcat "Cannot open file " s))
  34.   ) 
  35.   (princ)
  36.  
  37. ;;; --------------------------------------------------------------------------;
  38.  
  39.