When opening a file, the various procedures in this library accept a
file-options object that encapsulates flags to specify how the
file is to be opened. A file-options object is an enum-set
(see rnrs enums) over the symbols constituting valid file options.
A file-options parameter name means that the corresponding argument must be a file-options object.
Each file-options-symbol must be a symbol.
The
file-optionssyntax returns a file-options object that encapsulates the specified options.When supplied to an operation that opens a file for output, the file-options object returned by
(file-options)specifies that the file is created if it does not exist and an exception with condition type&i/o-file-already-existsis raised if it does exist. The following standard options can be included to modify the default behavior.
no-create- If the file does not already exist, it is not created; instead, an exception with condition type
&i/o-file-does-not-existis raised. If the file already exists, the exception with condition type&i/o-file-already-existsis not raised and the file is truncated to zero length.no-fail- If the file already exists, the exception with condition type
&i/o-file-already-existsis not raised, even ifno-createis not included, and the file is truncated to zero length.no-truncate- If the file already exists and the exception with condition type
&i/o-file-already-existshas been inhibited by inclusion ofno-createorno-fail, the file is not truncated, but the port's current position is still set to the beginning of the file.These options have no effect when a file is opened only for input. Symbols other than those listed above may be used as file-options-symbols; they have implementation-specific meaning, if any.
Note: Only the name of file-options-symbol is significant.