XLISP write-byte

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# write-byte

Type: | - | function (subr)
Source: | - | xlfio.c

## Syntax

(write-byte expr [dest])
  expr - an integer expression
  dest - an optional destination, must be a file pointer or stream, default is *standard-output*
  returns - the byte as an integer

## Description

The 'write-byte' function writes the 'expr' as a single byte to the specified 'destination'. Only the 'expr' byte is written. The 'expr' must be an integer expression. The 'expr' is returned as the result. The 'destination' may be a file pointer or a stream. If there is no 'destination', *standard-output* is the default.

## Examples

    (write-byte 67)                          ; prints C  returns 67

    (setq fp (open "t" :direction :output))  ; create file
    (write-byte 65 fp)                       ; returns 65
    (write-byte 66 fp)                       ; returns 66
    (write-byte 10 fp)                       ; returns 10
    (close fp)                               ; returns NIL

    (read (open "t" :direction :input))      ; returns AB

Common Lisp: Common Lisp specifies that print operations with a 'destination' of NIL will go to *standard-output*. XLISP does not send the output to *standard-output* with a 'destination' of NIL. Common Lisp also specifies that a 'destination' of T will be sent to *terminal-io*, which is not defined in XLISP by default. XLISP does not allow T as a valid argument for 'destination'.

See the write-byte function in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference