open-binary-input-file, open-binary-output-file - open a binary file
(import (scheme file)) ;R7RS
for a filename and returns a binary input or output port respectively.
When opening a file for input it must already exist. If the file
already exists when opening it for output the effect is unspecified.
Both procedures return a single value; a fresh binary input or output port.
These procedures are unique to R7RS. The
procedures are compatible replacements with stricter specifications.
These procedure can raise exceptions satisfying the following predicates:
- file-error? (R7RS)
Raised if the file cannot be opened. In particular, this is raised by
if the file does not exist.
It is an error if the wrong number of arguments was passed
or an argument was outside its domain.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
These procedures first appeared in R7RS.
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
You should be aware of what your implementation does when the file
already exists because there is no way to check for this condition
before attempting to open a file. The text in R7RS explicitly says
the effect is unspecified
when this happens.
You cannot check for this condition ahead of time using
because they are prone to time-to-check to time-of-use (TTCTOU) bugs.
If this is a concern then
can be used instead with appropriate options.
Markup created by unroff 1.0sc, March 04, 2023.