From: James Washer <[EMAIL PROTECTED]>
To: [email protected]
Subject: Re: JWW SPAM-bad-from  Re: [RLUG] quick question
Date: Fri, 30 Jun 2006 07:19:32 -0700

I don't know lisp at all, but I was more concerned about the ":if-exists :overwrite". Does this "overwrite" take place on open by trucating the file immediately, or does it simply leave the file pointer at zero, rather than openning in append mode?

it leaves the file pointer at zero, rather than opening in append mode. there's also :if-exists :supersede, :if-exists :append, :if-exists :error etc...

also there's no portable way to force the eof in cl--so unless you use an implementation/os-specific feature you stuck with making a second copy like all the other languages...

I agree with bill in theory (why modify the original at all if you don't have to?)... but wasn't the original question how to do it avoiding unecessary overhead/space requirements?

Nick


 - jim

On Fri, 30 Jun 2006 02:13:13 +0000
"n a" <[EMAIL PROTECTED]> wrote:

>
>
> >then again, you could do this in common lisp without having two copies of > >the file or having to have the whole file in memory by using two seperate
> >filestreams on the same file
> >
> >(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 ()))
>
> I'm not sure anyone cares, but I just realized this would still leave the > last 300 lines duplicated at the end of the document... off the top of my > head I don't know if it's possible to force an eof on an output file, I'll
> have to ask someone... it may in fact not be possible to get the desired
> effect of destructively rewriting the doc in it's own puddle of bits
>
> Nick
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
> _______________________________________________
> RLUG mailing list
> [email protected]
> http://lists.rlug.org/mailman/listinfo/rlug
>

_______________________________________________
RLUG mailing list
[email protected]
http://lists.rlug.org/mailman/listinfo/rlug

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


_______________________________________________
RLUG mailing list
[email protected]
http://lists.rlug.org/mailman/listinfo/rlug

Reply via email to