[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with fast-file-io example...
- To: firstname.lastname@example.org (Bill Andersen)
- Subject: Re: Problem with fast-file-io example...
- From: email@example.com (Bill St. Clair)
- Date: Mon, 29 Jun 1992 14:39:24 -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))))))))
Another comment. Error number -43 is "File not found." This probably
means you were trying to open a file for output. Note that you
must call CREATE-FILE explicitly to create a file that you plan
to open for output with FSOpen.