Function Entry: WRITE-LINE

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

Function Entry: WRITE-LINE

Name

write-line

Class

Function

Syntax

(write-line string [file-desc])

Arguments and Values

  • string: string
  • file-desc: optional output file descriptor

Description

Writes a line of text to the command line or to an open file.

Return Values

Host-defined success value.

Side Effects

Produces line-oriented output and appends an end-of-line marker under host file semantics.

Compatibility

End-of-line representation is an external-file concern and may differ from the implementation host defaults.

Availability

  • AutoCAD 2026: documented (per Autodesk reference page).
  • BricsCAD V26: presumed compatible (no contradicting page found).
  • Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.

Notes

Tested Behaviour (product-tested, 2026-11-03 – a character the file's encoding cannot hold)

The error-processing catalogue (probes/error-processing/, cases 535-545) wrote a string with write-line through (open f "w"), the product's default write encoding, and read the file back with read-char. Neither reference documents the case; no product signals:

string written AutoCAD 2022 (accoreconsole) BricsCAD V25 Windows BricsCAD V26 macOS
(chr 300) "," (44): the low byte "I": best fit the 8 characters \U+012C
"a" U+4E2D "b" "a-b" "a?b" "a\U+4E2Db"

AutoCAD already keeps the low byte in CHR ((ascii (chr 300)) is 44), so its file only follows; BricsCAD V25 applies the Windows best-fit conversion to its code page; BricsCAD V26 keeps the character and escapes it on output.

clautolisp

clautolisp implementation deviation – not part of the normative specification above. The specification adopts none of the three behaviours. clautolisp applies a replacement policy to WRITE-LINE, WRITE-CHAR, PRINC, PRIN1, PRINT and PROMPT whenever a character does not fit the destination's encoding: one character, error, low-byte, best-fit or escape. In order: the command-line option -Ereplacement (or -Efile-write-replacement / -Eterminal-out-replacement) through the setq-able globals *AUTOLISP-ENCODING-REPLACEMENT*, *AUTOLISP-FILE-WRITE-ENCODING-REPLACEMENT* and *AUTOLISP-TERMINAL-ENCODING-REPLACEMENT*; the clautolisp system variable CLAUTOLISPENCODINGREPLACEMENT (seeded from the environment variable of the same name); then the dialect. Each dialect behaves as its product, and --dialect clautolisp as BricsCAD V26 macOS (pjb, error-processing-per-dialect section 7):

dialect policy warning
--dialect autocad[-*] low-byte [encoding-replacement]
--dialect bricscad[-v*] (Windows) best-fit [encoding-replacement]
--dialect bricscad-mac / -linux escape [encoding-replacement]
--dialect clautolisp, --strict escape [encoding-replacement]
--lax escape silent

The warning fires the first time a calling function makes a builtin substitute, under every dialect but --lax, including when the user chose the policy. With error, the write signals an ordinary AutoLISP error (*error*, vl-catch-all-apply) before anything is written. An explicit OPEN external format carrying its own :replacement keeps its precedence.

SPEC-UNCERTAIN: the BricsCAD split is taken to be the platform's (Windows' conversion API), not the version's – only V25-Windows and V26-macOS were measured, and Linux not at all; clautolisp's best fit strips the diacritic from a Latin letter, which approximates but is not Windows' best-fit table; AutoCAD's low byte was measured at an unrecorded LISPSYS, and only in accoreconsole.