stdin()
, stdout()
and stderr()
are standard
connections corresponding to input, output and error on the console
respectively (and not necessarily to file streams). They are text-mode
connections of class "terminal"
which cannot be opened or
closed, and are read-only, write-only and write-only respectively.
The stdout()
and stderr()
connections can be
re-directed by sink
(and in some circumstances the
output from stdout()
can be split: see the help page). The encoding for stdin()
when redirected can
be set by the command-line flag --encoding.
showConnections
returns a matrix of information. If a
connection object has been lost or forgotten, getConnection
will take a row number from the table and return a connection object
for that connection, which can be used to close the connection,
for example. However, if there is no R level object referring to the
connection it will be closed automatically at the next garbage
collection (except for gzcon
connections).
closeAllConnections
closes (and destroys) all user
connections, restoring all sink
diversions as it does
so.
isatty
returns true if the connection is one of the class
"terminal"
connections and it is apparently connected to a
terminal, otherwise false. This may not be reliable in embedded
applications, including GUI consoles.