EOF condition in (read) from file 
Author Message
 EOF condition in (read) from file

   Path: news.bbn.com!uhog.mit.edu!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!spool.mu.edu!olivea!nntp.msstate.edu!nntp.msstate.edu!nn1

   Newsgroups: comp.lang.lisp,comp.lang.lisp.x
   Date: 7 Feb 94 19:12:32
   Organization: Mississippi State University
   Lines: 26
   Distribution: usa
   NNTP-Posting-Host: isis.msstate.edu
   Xref: news.bbn.com comp.lang.lisp:11886 comp.lang.lisp.x:1161

          I am running lucid lisp on a sun machine and the following code
   does not detect the EOF condition.  Can anybody tell me why ?

   (setq temp (read in t 'EOF))
   (if (equal temp 'EOF

   or the code

   (setq temp (read in 'EOF))
   (if (equal temp 'EOF)

   I am reading the values from an ascii file but I get struck at the end
   of the file.  The second version worked in xlisp some time back, but I
   could not use xlisp as I wanted to use the (file-position in :start) and
    (random 0.2 state) functions.

     I could not find anything about this in the FAQs.  Please reply to

Try using read with the second argument (eof-error-p) being nil.

> ;;; Arglist read


So, the following should work:

(setq temp (read in nil 'eof))
(if (eq temp 'eof) ...)
Ken Anderson

BBN STC              Work Phone: 617-873-3160
10 Moulton St.       Home Phone: 617-643-0157
Mail Stop 6/4c              FAX: 617-873-3776
Cambridge MA 02138

Mon, 29 Jul 1996 17:45:55 GMT  
 [ 1 post ] 

 Relevant Pages 

1. I want to stop a while condition when I read a EOF of text file

2. I want to stop a while condition when I read a EOF of text file

3. Q: EoF marker and reading file

4. file.read(num) returns empty string before EOF.


6. Help with binary files, read, and eof

7. Problem reading data from a file (encounter EOF after second last record)

8. eof fails when reading encrypted data in text file

9. A good idiom for EOF when READing files?

10. Help with MF Cobol/Unix/EOF Condition

11. Clearing eof condition from stream.

12. eof on channel, not eof on transform: [eof] returns true


Powered by phpBB® Forum Software