* Checking for end of file
@ 2004-02-13 19:57 Mike Flippin
2004-02-13 21:19 ` Roland Orre
0 siblings, 1 reply; 2+ messages in thread
From: Mike Flippin @ 2004-02-13 19:57 UTC (permalink / raw)
Could someone tell me how you check for an end of file?
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Checking for end of file
2004-02-13 19:57 Checking for end of file Mike Flippin
@ 2004-02-13 21:19 ` Roland Orre
0 siblings, 0 replies; 2+ messages in thread
From: Roland Orre @ 2004-02-13 21:19 UTC (permalink / raw)
Cc: guile-user
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)))
(cond
((eof-object? result)
(close-input-port in))
(else
(display result)
(newline)
(loop (read-line in))))))
Best regards
Roland
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-13 21:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-13 19:57 Checking for end of file Mike Flippin
2004-02-13 21:19 ` Roland Orre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).