The open-input-file and open-output-file procedures can take an optional argument after the filename that specifies a mode for the file. This additional argument must be either 'text or 'binary, indicating that the file should be opened using text mode or binary mode. By default, files are opened in binary mode.
The open-output-file procedure can also take an argument that specifies how to proceed when a file with the specified name already exists:
Extra arguments are passed to open-output-file in any order. Appropriate arguments can also be passed as the last argument(s) to call-with-input-file, with-input-from-file, call-with-output-file, and with-output-to-file. When conflicting arguments are passed to open-output-file, with-output-to-file, or call-with-output-file, the exn:application:mode-conflict exception is raised.