Go to the first, previous, next, last section, table of contents.
The following procedures are used to open file ports.
See also section Ports and File Descriptors, for an interface
to the Unix open
system call.
- primitive: open-file string mode
-
Open the file whose name is string, and return a port
representing that file. Whether an input or output port is
allocated is determined by the mode string. This is
interpreted in the traditional Unix manner: use `r' for
reading, `w' for writing, and `a' for appending. In
addition, `0' can be used to specifiy an unbuffered port.
See
the stdio
documentation for your system for more
I/O mode options.
If a file cannot be opened, open-file
throws an exception.
- procedure: open-input-file filename
-
Open filename for input. Equivalent to
(open-file filename "r")
- procedure: open-output-file filename
-
Open filename for output. Equivalent to
(open-file filename "w")
- primitive: port-mode port
-
Return the mode flags from the open port.
- primitive: port-filename [port]
-
Return the filename associated with port. This function returns
the strings "standard input", "standard output" and "standard error"
when called on the current input, output and error ports respectively.
- primitive: set-port-filename! [port] filename
-
Change the filename associated with port, using the current input
port if none is specified. Note that this does not change the port's
source of data, but only the value that is returned by
port-filename
and reported in diagnostic output.
- primitive: %make-void-port mode
-
Create and return a new void port. The mode argument describes
the permissions to use for this port; for a description, see the
documentation for
open-file
in section File Ports.
Go to the first, previous, next, last section, table of contents.