[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with fsOpen and fsRead



I have the following code:

	(require :mac-file-io)
	(defun test (&optional (buffer-size 25))
    	  (let (filename
          	paramblock
	  	(buffer (#_newptr buffer-size)))
       	     (setq filename (choose-file-dialog))    ;get a file
       	     (setq paramblock (fsOpen filename))     ;open it
       	     (fsRead paramblock buffer-size buffer)  ;try to read from it
       	     (fsclose paramblock)
       	     (#_disposptr buffer)))

After evaluating this code, I repeatedly call (test) and then choose 
different files.  About half the time, the function "test" works with
no errors, and the rest of the time I get an file error message -36 or
occasionally a -39, even when the file is very large.
Can anyone explain to me why I get these error messages?  I can see no pattern
to the fact that "test" works for some files and not others.  It even
works sometimes for a file and at other times fails for the
same file.

Dale Skrien
djskrien@colby.edu