Up: Files and Filenames   [Contents][Index]


6.1.1 Reading File Streams

The most basic file I/O task is to read the contents of a file. To do so, you obtain a stream from which you can read a file’s contents. You do this with the open function.

Function: open filespec &key direction element-type if-exists if-does-not-exist external-format

Open returns a character-based input stream that can be passed along to other functions that read characters of text.

FILESPEC

The name of the file to read. This can be one of a string ("namestring"), a pathname object, or a stream object, all collectively called pathname designators. Pathnames represent filenames in a structured way that makes them easy to manipulate without tying them to a particular filename syntax.