tags:

views:

159

answers:

2

cann't read text file.

READ: input stream #1=# has reached its end [Condition of type SYSTEM::SIMPLE-END-OF-FILE]

what means is "has reached its end."

+1  A: 

It means that you have read all the data available at the location you opened the stream to, and then you tried to read some more.

bmargulies
+1  A: 

Check out the documentation at the HyperSpec:

http://www.lispworks.com/documentation/HyperSpec/Body/f_rd_rd.htm

By default, READ, READ-CHAR, and similar functions will signal a condition of type END-OF-FILE when there's no more data to be read from the stream.

If you want it to instead return a specific value when trying to read past the end of the stream, you'll need to pass a nil to the eof-error-p param of the function, and a value, symbol or keyword to the eof-value parameter of the function; which is the data that you will get back when the end of the file/stream is reached.

For example, if you were reading the chars individually from a piece of text:

(with-open-file (s somefile :direction :input)
  (do ((c (read-char s nil :eof)
          (read-char s nil :eof)))
    ((eql c :eof) 'done)
    (process-char c)))
Jorge Gajon
Also, be aware that `READ` parses the read text into Lisp objects, and if the text is not valid, an error condition will be signaled.
Jorge Gajon