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

Bug in Random File Access

    Date: Wed, 9 Dec 87 16:30+0100
    From: "Juergen Krey" <unido!gmdzi!LISPM-3!krey@uunet.uu.net>

    The following bug concerns the Random Access File capability of Genera
    7.1 .  I tried to open a file in random access mode an another host with
    the following code.  There are no hints in Manual 5, that my options to
    opening a file are inconsistent.

    (defun do-it (&optional (path "aid:>krey>network>atu_2.lisp"))
      (setq path (fs:parse-pathname path))
      (with-open-file (in  path :direction :input :direct t)
	(read-record in 0 10)))

    I think I remember this working in Rel 6.x

The problem is that you are opening a character stream instead of a
binary stream.  Whenever you open a character stream to a file, the
Lispm always tries to read the attribute list (the -*- line at the
beginning).  In the case of direct access streams this loses because it
hasn't done a :READ-BYTES first.

You'll have to add :element-type '(unsigned-byte 8) to your
WITH-OPEN-FILE, and change READ-RECORD to convert the bytes to