Star Sapphire Common LISP Home

Download Star Saphire
Index

23. FILE SYSTEM INTERFACE

This chapter contains the following sections:

23.1 Opening and Closing Files

23.2 Renaming, Deleting and other File Operations

23.3 Loading Files

 

A frequent use of streams is to communicate with a file system to which groups of data (files) can be written and from which files can be retrieved.

Pathnames and filenames, in this implementation, are represented by either symbols or strings.

 

23.1 Opening and Closing Files

When a file is opened, a stream object is constructed to serve as the file system's ambassador to the LISP environment; operations on the stream are reflected by operations on the file in the file system.

The act of closing the file (actually, the stream) ends the association; the transaction with the file system is terminated, and input/output may no longer be performed on the stream. The stream function close may be used to close a file; the functions described below may be used to open them. The basic operation is open, but with-open-file is usually more convenient for most applications.

These functions and macros are used to open files:

open

with-open-file

 

23.2 Renaming, Deleting and other File Operations

The following functions provide a standard interface to various file system operations:

rename-file

delete-file

probe-file

file-write-date

file-author

file-position

file-length

 

23.3 Loading Files

To load a file is to read through the file, evaluating each form in it as if it were typed in response to the LISP prompt.

Programs are typically stored in files; the expressions in the file are mostly special forms such as defun, defmacro, and defvar, which define the functions and variables of the program.

The following function is used to load a file:

load