However, the following program loops forever in CLISP for Windows:
(DEFUN LEER-TEXTO ()
(WITH-OPEN-FILE (F1 "kk.txt" :DIRECTION :INPUT)
(LOOP
(MULTIPLE-VALUE-BIND (LINEA FINAL)
(READ-LINE F1 NIL)
(TERPRI)
(PRINC LINEA)
(WHEN FINAL (RETURN))))))
(LEER-TEXTO)
when "kk.txt" contains the two lines
asdf
<EOF>
but behaves properly when "kk.txt" contains a space in the second line
asdf
<EOF>
Is this a little bug in CLISP or am I misunderstanding the
specification?
Thanks.
---------------------
Jose-Luis Perez-de-la-Cruz
ETSI Informatica
POB 4114
MALAGA 29080 SPAIN
Tlf +34 952 132801
Fax +34 952 131396
--------------------
since you return whatever object CLISP elects to mean end-of-file when
you hit the end of file, I suppose you get a lot of that object printed
while READ-LINE continues to hit its head at the end of the file when the
last line was properly terminated.
#:Erik
That's exactly what happens.
then that's the expected and correct behavior.
if you don't want this behavior, supply READ-LINE with a value that you
can check against to see that you have hit the end of the file. I tend
to use the keywof :EOF when dealing with characters or strings.
#:Erik