current-input-port, current-output-port, current-error-port - get the current (default) ports
LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs io ports)) ;R6RS
(import (rnrs io simple)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
SYNOPSIS
(current-input-port)
(current-output-port)
(current-error-port)
DESCRIPTION
These return default textual ports for regular input, output and error
output. Normally, these default ports are associated with standard
input, standard output, and standard error, respectively.
The return value of
current-input-port
and
current-output-port
can be dynamically re-assigned using
with-input-from-file(3scm)
and
with-output-to-file(3scm)
respectively.
A port returned by one of these procedures may or may not have an
associated transcoder; if it does, the transcoder is
implementation-dependent.
- R7RS
-
These procedures are parameter objects, which can be overridden with
parameterize(7scm).
IMPLEMENTATION NOTES
Standard input, output and error ports are concepts in general purpose
operating systems. The implementation should hook these ports up to
whatever standard I/O mechanism is provided by the operating system,
if any.
The error port should usually be unbuffered so that no output is lost
if the program exits unexpectedly.
RETURN VALUES
These procedures return a single value; a port.
EXAMPLES
(display "There was an error.0 (current-error-port))
COMPATIBILITY
R7RS defines these procedures as parameters. They are likely to
internally be some form of parameters in all implementations, however,
because of how
with-input-from-file(3scm),
etc, works. But one cannot expect to portably use them as parameters
outside of R7RS.
ERRORS
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
-
The wrong number of arguments was passed or an argument was outside its domain.
- R7RS
-
The assertions described above are errors.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
SEE ALSO
standard-input-port(3scm),
parameterize(7scm),
with-input-from-file(3scm)
STANDARDS
R4RS,
IEEE Scheme,
R5RS,
R6RS,
R7RS
HISTORY
The
current-error-port
procedure first appeared in R6RS.
The other procedures are standard since R2RS.
AUTHORS
This page is part of the
scheme-manpages
project.
It includes materials from the RnRS documents.
More information can be found at
https://github.com/schemedoc/manpages/
.
Markup created by unroff 1.0sc, March 04, 2023.