From siponen@amadeus.cs.hut.fi Thu May 19 13:29:19 EDT 1994 Article: 12818 of comp.lang.lisp Xref: glinda.oz.cs.cmu.edu comp.lang.lisp:12818 Path: honeydew.srv.cs.cmu.edu!nntp.club.cc.cmu.edu!godot.cc.duq.edu!news.duke.edu!convex!cs.utexas.edu!howland.reston.ans.net!EU.net!sunic!news.funet.fi!sauna.cs.hut.fi!freenet.hut.fi!freenet.hut.fi!siponen From: siponen@amadeus.cs.hut.fi (Lauri Siponen) Newsgroups: comp.lang.lisp Subject: Re: copy-file Date: 16 May 1994 11:35:07 GMT Organization: Freenet finland Lines: 24 Message-ID: References: <2r12bo$bim@underdog.jpl.nasa.gov> NNTP-Posting-Host: amadeus.cs.hut.fi In-reply-to: ch+@cs.cmu.edu's message of Mon, 16 May 1994 02:15:58 GMT dpANS introduces some new operations on streams. READ-SEQUENCE and WRITE-SEQUENCE allow efficient I/O on files. This version of copy-file copies multiple megabyte files easily. I ran it on Allegro CL 4.2, SunOS 4.1.3. (defun copy-file (source target) ;; Just an example! (with-open-file (in source :direction :input) (with-open-file (out target :direction :output :if-exists :supersede) (loop with buffer = (make-string (* 64 512)) for n = (read-sequence buffer in) until (= n 0) do (write-sequence buffer out :end n))))) READ-SEQUENCE and WRITE-SEQUENCE are not yet supported on every Lisp implementation, but if they will be included in Lisp standard, their availability should increase. -- Lauri Siponen, Helsinki University of Technology