Function Entry: OPEN
← Prev | ↑ Chapter | Next → | Index | Symbols
Function Entry: OPEN
Name
open
Class
Function
Syntax
(open filename mode [encoding])
Arguments and Values
filename: stringmode: string designating read, write, or appendencoding: optional encoding designator in newer Autodesk versions
Description
Opens a file and returns a file descriptor.
Return Values
Returns a FILE descriptor or nil on failure, depending on host behavior and context.
Side Effects
Creates or opens an external file channel.
Affected By
- path-resolution rules
- trusted-path rules
- encoding support
Exceptional Situations
Errors are reported for invalid paths, modes, or inaccessible files.
Examples
(open "foo.txt" "r")
Compatibility
- older Autodesk forms lacked explicit encoding
- BricsCAD documents richer text mode handling
Notes
clautolisp should decouple path semantics from native OS via environment profiles.
In clautolisp, open resolves a relative name through the support search
path (an existing file is found on the path; a new name falls back to the
current directory, so write semantics are unchanged), and it is gated by
the trust model for files whose extension is in the gated set: at
SECURELOAD 2 an untrusted gated file is blocked (ERRNO + a
:open-untrusted-file error), at 1 it warns and proceeds; ordinary data
files are never gated. Autodesk does not gate open — this is a
clautolisp extension (1.2.18 / 1.2.20). See Normative Rules: Secure File
Loading and Trust Model (this chapter).
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.
See Also
- BricsCAD V26 extends
openwith encoding selectors of the form"r,ccs=UNICODE","r,ccs=UTF-8","r,ccs=UTF-16LE","w,ccs=UTF-8","w,ccs=UTF-16LE". AutoCAD does not accept these; AutoCAD's Unicode story is governed by theLISPSYSsystem variable instead. - Divergence documented in
vendor-inventory-2026.org§10 item 2.
Source Notes
- [open (AutoLISP), current](https://help.autodesk.com/cloudhelp/2026/PLK/AutoCAD-LT-AutoLISP-Reference/files/GUID-089A323F-21FF-4337-99A9-375758E23BA4.htm)
- [open (AutoLISP), earlier](https://help.autodesk.com/cloudhelp/2015/ENU/AutoCAD-AutoLISP/files/GUID-089A323F-21FF-4337-99A9-375758E23BA4.htm)
- [read + write text files (BricsCAD)](https://developer.bricsys.com/bricscad/help/en_US/V25/DevRef/source/readwritetextfiles.htm)
- Status: documented with version drift.