[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with fast-file-io example...
- To: email@example.com (Bill Andersen)
- Subject: Re: Problem with fast-file-io example...
- From: firstname.lastname@example.org (Bill St. Clair)
- Date: Mon, 29 Jun 1992 14:23:49 -0500
- Cc: info-mcl
> I was trying to use the fast-file-io code in the Examples folder
>supplied with MCL, and am getting error #-43 when I try to call
>(with-fsopen-file...). Is there a problem with this code? Is the
>problem potentially with my Mac? What is the (fswrite...) function
>expecting for the "buffer" argument? Any examples out there?
I assume you mean "mac-file-io.lisp". Here's an example of using
it. The "buffer" argument is a macptr pointing to an area of
memory big enough for "count" bytes.
; This always overwrites an existing to-file
(defun my-copy-file (from-file to-file)
(with-FSOpen-file (from-pb from-file)
(setq to-file (merge-pathnames to-file from-file))
(create-file to-file :if-exists nil)
(with-FSOpen-file (to-pb to-file t)
(%stack-block ((buf 512))
(let ((size (getEOF from-pb)))
(when (<= size 0) (return))
(let ((bytes (min size 512)))
(fsRead from-pb bytes buf)
(fsWrite to-pb bytes buf)
(decf size 512))))))))