[Ecls-list] Reading binary file
Goffioul Michael
goffioul at imec.be
Wed May 3 05:44:04 UTC 2006
> > I think that you have to use read-byte to read a binary stream.
>
> From CLHS:
>
> "Exceptional Situations:
>
> Should be prepared to signal an error of type type-error if
> sequence is not a proper sequence. Should signal an error of
> type type-error if start is not a non-negative integer.
> Should signal an error of type type-error if end is not a
> non-negative integer or nil.
>
> Might signal an error of type type-error if an element read
> from the stream is not a member of the element type of the sequence."
>
> So basically it doesn't say anything about being restricted
> to only ascii stream. Only if the types of stream and
> sequence aren't matching then it could signal an error. And
> Imago is using type '(unsigned-byte 8) for both stream and
> sequence so it should work in all accounts.
>
> So it would mean that:
>
> read-char reads char
> read-byte reads binary
> read-sequence reads char and binary
I was too fast in my answer. Looking at the code, it should work
correctly. However, I think there's a bug in file.d around line
1572: the mode of the stream to check should be smm_input instead
of smm_output. Juanjo, do you confirm? (I'll commit the change
if you're OK).
I guess this bug was never triggered, because it happens to still
work with character streams.
Michael.
More information about the ecl-devel
mailing list