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 semanticsfile-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-charemits 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 sequenceC3 A9on BricsCAD V26 under macOS.- Consequence:
write-charcannot portably emit an arbitrary byte. Code that needs exact bytes on disk must not go through it. - The
write-char/read-charpair is asymmetric.write-charwrites an encoded character;read-charreads 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 useread-line/write-linewhere 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
- [About File Descriptors (AutoLISP)](https://help.autodesk.com/cloudhelp/2024/CHT/AutoCAD-AutoLISP/files/GUID-EDADF856-4D64-4E19-A7BD-5017C4135A01.htm)
- Runtime probe: alpm
tests/verification/verification.lsp(V-10), 2026-08-09. - [What's New or Changed with AutoLISP (AutoLISP)](https://help.autodesk.com/cloudhelp/2026/CHS/AutoCAD-MAC-AutoLisp/files/GUID-037BF4D4-755E-4A5C-8136-80E85CCEDF3E.htm)
- Status: documented.