Function Entry: WRITE-CHAR

← Prev | ↑ Chapter | Next → | Index | Symbols

Function Entry: WRITE-CHAR

Name

write-char

Class

Function

Syntax

(write-char char [file-desc])

Arguments and Values

  • char: character value or code under host character semantics
  • file-desc: optional output file descriptor

Description

Writes one character to the command line or to an open file.

Return Values

Host-defined success value.

Side Effects

Produces output to the selected destination.

Compatibility

Character interpretation is version-sensitive in Unicode-capable environments.

Notes

  • write-char emits a character, not a byte — verified 2026-08-09. The value is written in the platform encoding, so the number of bytes produced depends on the engine's platform, not on the argument. Writing code 233 (é) produces one byte, 233, on clautolisp and on both Windows CADs, but the two-byte UTF-8 sequence C3 A9 on BricsCAD V26 under macOS.
  • Consequence: write-char cannot portably emit an arbitrary byte. Code that needs exact bytes on disk must not go through it.
  • The write-char / read-char pair is asymmetric. write-char writes an encoded character; read-char reads raw bytes (see its own § Notes). They round-trip only where the platform encoding is single-byte. On a UTF-8 platform, writing é and reading it back yields two values, (195 169), not the one that was written — with no error to signal that a decode was skipped. Portable code should treat the pair as byte I/O on one side and encoded I/O on the other, and use read-line / write-line where text semantics are wanted.

Availability

  • AutoCAD 2026: documented (per Autodesk reference page).
  • AutoCAD 2022, BricsCAD V25 and V26: platform-encoding behaviour verified by runtime probe 2026-08-09.
  • Status: verified on both vendors (no longer "presumed compatible").

Source Notes