force eof on an output stream
- From: nallen05@xxxxxxxxx
- Date: 29 Jun 2006 19:40:59 -0700
someone asked if it's possible to remove the first 300 lines of a file
without ever having two copies of the file or loading the entire thing
into memory.
(with-open-file (in #p"/path/to/bigfile" :direction :input)
(with-open-file (out #p"/path/to/bigfile"
:direction :output
:if-exists :overwrite)
(dotimes (i 300) (read-line in))
(handler-case
(loop (princ (read-line in) out) (terpri out))
(error ()))
would leave the last 300 lines duplicated at the end of the file... Is
it possible to "force" an eof to an output stream? I'm just a pig
farmer and don't know these kind of things...
Nick
.
- Follow-Ups:
- Re: force eof on an output stream
- From: Pascal Bourguignon
- Re: force eof on an output stream
- Prev by Date: keyword question
- Next by Date: Re: keyword question
- Previous by thread: keyword question
- Next by thread: Re: force eof on an output stream
- Index(es):