ID EN
Miscellaneous

showConnections

R Base 3.6.2

Display aspects of connections.

Syntax

R
showConnections(all = FALSE)
getConnection(what)
closeAllConnections()<p></p><p>stdin()
stdout()
stderr()
nullfile()</p><p>isatty(con)</p>

Arguments

Parameter Description
all logical: if true all connections, including closed ones and the standard ones are displayed. If false only open user-created connections are included.
what integer: a row number of the table given by showConnections.
con a connection.

Return Value

stdin(), stdout() and stderr() return connection objects. showConnections returns a character matrix of information with a row for each connection, by default only for open non-standard connections. getConnection returns a connection object, or NULL.

Details

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. nullfile() returns filename of the null device ("/dev/null" on Unix, "nul:" on Windows). 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

Examples

Example
R
# NOT RUN {
showConnections(all = TRUE)
# }
# NOT RUN {
textConnection(letters)
# oops, I forgot to record that one
showConnections()
#  class     description      mode text   isopen   can read can write
#3 "letters" "textConnection" "r"  "text" "opened" "yes"    "no"
mycon <- getConnection(3)
# }
# NOT RUN {
c(isatty(stdin()), isatty(stdout()), isatty(stderr()))
# }

See Also

connections