Function Entry: PRINC
← Prev | ↑ Chapter | Next → | Index | Symbols
Function Entry: PRINC
Name
princ
Class
Function
Syntax
(princ [expression [fileHandle]])
Arguments and Values
expression(optional): any AutoLISP expression or value. If omitted, nil is used.fileHandle(optional): handle of a file as obtained from(open …). If omitted or nil, output goes to the command line.
Description
Prints expression to the command line, or writes it to the open file fileHandle. The representation is display-oriented: unlike prin1, control characters in a string expression are written verbatim (no \n / \t / escaped-double-quote rewriting). With no argument, (princ) returns the void symbol value and is the conventional way to terminate a defun without emitting anything.
Return Values
Returns the evaluated value of expression, or void with no argument.
Side Effects
Writes the printed representation to the command line or to fileHandle.
Examples
With (setq x 123):
(princ x)prints123to the command line and returns123.(princ x fh)writes123to file handlefhand returns123.
Tested Behaviour (BricsCAD V26 / macOS, 2026-04-26)
(princ "hello" file-desc) returns "hello" and writes the five characters hello to the file (no surrounding quotes, no trailing newline). Confirms the verbatim representation, distinct from prin1's round-trippable representation.
Availability
- AutoCAD 2026: documented (Autodesk reference page).
- BricsCAD V26: documented + product-tested on macOS (probe suite, 2026-04-26). 2-argument form accepted; output is verbatim (no escape rewriting).
- Status: documented in both vendors and tested against BricsCAD V26 / macOS.
See Also
- probe-output.lsp — executable Phase-5 probe suite.
- probe results, BricsCAD V26 / macOS, 2026-04-26.
prin1for the round-trippable form.vl-princ-to-stringfor the string-returning companion.
Source Notes
- [princ (AutoLISP 2026)](https://help.autodesk.com/cloudhelp/2026/ENU/AutoCAD-AutoLISP-Reference/files/GUID-7DDA298B-A97C-49C9-94BA-46C77B50AE99.htm)
- [princ (BricsCAD V26 DevRef)](https://developer.bricsys.com/bricscad/help/en_US/V26/DevRef/source/princ.htm)
- Status: documented and product-tested (Phase 5 closure).
clautolisp: how a real prints
As prin1 (see its "Measured" and "clautolisp" notes): the AutoCAD dialects
print a real as AutoCAD (0.333333), the BricsCAD dialects as BricsCAD
(0.333333333333333), clautolisp / strict / lax in clautolisp's own
spelling; a [real-format] notice the first time the products differ.
Tested Behaviour (explicit NIL file, 2026-11-04)
(princ "x" nil), (print "x" nil) and (prin1 "x" nil), called through
vl-catch-all-apply with the products' own primitives:
- AutoCAD 2022 (accoreconsole, Windows, ACADVER 24.1, LISPSYS 0): all three are an error, "type d'argument incorrect: FILE nil" (bad argument type).
- BricsCAD V26 (macOS): all three print to the command line and return
"x";(write-line "x" nil)and(write-char 65 nil)are accepted too.
Both references document NIL: Autodesk types the argument "File or nil", Bricsys says "if omitted or NIL is used, output goes to command line". So AutoCAD 2022 contradicts its own reference, and the Arguments above keep the documented behaviour.
clautolisp: an explicit NIL file
clautolisp implementation deviation – not part of the normative specification above. A product contradicting an agreed reference: case 2 of the dialect divergence rules, the documented behaviour normative.
--dialect autocad(every version): reproduces AutoCAD 2022 – an explicit NIL file is a bad-argument error – and warns;--strict: prints to the command line, as documented, and warns;--dialect bricscad,--dialect clautolisp,--lax: print to the command line, silently.
The warning is [printer-nil-file], once per run. The one-argument call
((princ x)) is the same everywhere and never warns. Portable spelling:
omit the argument, (if f (princ x f) (princ x)). AutoCAD 2026 and
LISPSYS 1 / 2 are unmeasured and assumed to behave as AutoCAD 2022
(deferred-spec-research). See
issues/closed/autocad-output-explicit-nil-file-rejected.issue.