[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking for end of file

From: Roland Orre
Subject: Re: Checking for end of file
Date: Fri, 13 Feb 2004 22:19:19 +0100

On Fri, 2004-02-13 at 20:57, Mike Flippin wrote:
> Could someone tell me how you check for an end of file?

Reading routines at scheme level generally return the eof-object when
hitting the end of file. This can be tested for by eof-object?, like:

(let ((in (open-input-file "test.txt")))
  (let loop
      ((result (read-line in)))
     ((eof-object? result)
      (close-input-port in))
      (display result)
      (loop (read-line in))))))

Best regards

reply via email to

[Prev in Thread] Current Thread [Next in Thread]