Star Sapphire Common LISP Home

Download Star Saphire
Index

21. STREAMS

This chapter contains the following sections:

21.0 Introduction to Streams

21.1 Standard Streams

 

21.0 Introduction to streams

Streams serve as sources or sinks of data.

Character streams produce or absorb characters; binary streams produce or absorb bytes.

Normally a Common LISP interpreter reads from a character input stream and writes to a character output stream.

Typically streams are connected to files or to an interactive terminal. Streams, being LISP objects, serve as the ambassadors of external devices by which input/output is accomplished.

One advantage of the stream abstraction is that they can also transparently read and write to/from a string as well as a device, without changing any code except that which opens the stream.

A stream, whether a character stream or a binary stream, may be input-only, output-only, or bi-directional. What operations may be performed on a stream depends on what kind of streams it is.

 

21.1 Standard Streams

There are several variables whose values are streams used by many functions in the LISP system. These variables are listed here. These streams are opened at startup.

*standard-input*

*standard-output*

*error-output*

The following Star Sapphire specific streams are opened at startup in addtion to the above:

*standard-aux*

*printer-output*

The following predicates on streams are supported:

input-stream-p

output-stream-p

The following function closes an stream; to open a stream see open.

close