Next: , Up: File Objects   [Contents][Index]


5.26.2.1 Creating File Objects

Function: open-file file-name mode

This function opens the file called file-name (see File Names) and returns the new file object.

The mode argument is a symbol defining the access modes used to open the file with, the options are:

read

Open an existing file for reading only.

write

Open the file for writing only, if the file exists it is truncated to zero length. Otherwise a new file is created.

append

Open the file for appending to, i.e. writing to the end of the file. If the file doesn’t exist it is created.

The three standard I/O streams are also available as file handles.

Function: stdin-file

Return a file object representing the interpreters standard input.

Function: stdout-file

Return a file object representing the interpreters standard output.

Function: stderr-file

Return a file object representing the interpreters standard error.

Attempting to close any of these files will result in the associated stream being connected to /dev/null.