21.1. Interactive Streams [sec_21-1-1-1-3]

21.1.1. Initialization of Standard Streams

Interactive streams are those whose next input might depend on a prompt one might output.

21.1.1. Initialization of Standard Streams

When run interactively, CLISP creates a single terminal STREAM and binds *TERMINAL-IO* to it. All other standard streams (*STANDARD-INPUT*, *STANDARD-OUTPUT* *ERROR-OUTPUT*, *TRACE-OUTPUT*, *QUERY-IO*, *DEBUG-IO*) are SYNONYM-STREAMs pointing to *TERMINAL-IO*. This has the benefit of avoiding unwanted blank lines from FRESH-LINE, see Section 21.6, “Newline Convention”.

However, there may be situations, especially in batch mode, when one wants to use a C-style i/o where *STANDARD-OUTPUT* and *ERROR-OUTPUT* point to different OS file descriptor so that they can be redirected to files in the command line and examined separately. Often CLISP can detect such situations (stdout and stderr not being the terminal) and handle them just as expected. However, there may be cases when one needs to do something like:

(SETQ *STANDARD-INPUT* (EXT:MAKE-STREAM :INPUT)
      *STANDARD-OUTPUT* (EXT:MAKE-STREAM :OUTPUT :BUFFERED T)
      *ERROR-OUTPUT* (EXT:MAKE-STREAM :ERROR :BUFFERED T))

in the script or init function.


These notes document CLISP version 2.49Last modified: 2010-07-07