Function Entry: OPEN

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

Function Entry: OPEN

Name

open

Class

Function

Syntax

(open filename mode [encoding])

Arguments and Values

  • filename: string
  • mode: string designating read, write, or append
  • encoding: 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 open with 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 the LISPSYS system variable instead.
  • Divergence documented in vendor-inventory-2026.org §10 item 2.