13.2. Input/Output model

ECL distinguishes between two kinds of streams: character streams and byte streams. In the first kind one is only allowed to write characters, either individually, with write-char, or in chunks, with write-sequence or any of the Lisp printer functions. The implementation of character streams in ECL has the following shortcomings:

The other kind are binary streams. Here input and output is performed in chunks of bits. Binary streams are created with the function open passing as argument a subtype of integer. We distinguish two cases

In the first case the length of the file can be deduced from the number of octets which are used in the filesystem. In the second case, however, one needs some extra information which tells how many bits in the last byte are significant for the content. This information is stored as a single-byte header at the beginning of the file.