EVOLUTION-MANAGER
Edit File: showConnections.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Display Connections</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for showConnections {base}"><tr><td>showConnections {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Display Connections</h2> <h3>Description</h3> <p>Display aspects of <a href="connections.html">connections</a>. </p> <h3>Usage</h3> <pre> showConnections(all = FALSE) getConnection(what) closeAllConnections() stdin() stdout() stderr() nullfile() isatty(con) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>all</code></td> <td> <p>logical: if true all connections, including closed ones and the standard ones are displayed. If false only open user-created connections are included.</p> </td></tr> <tr valign="top"><td><code>what</code></td> <td> <p>integer: a row number of the table given by <code>showConnections</code>.</p> </td></tr> <tr valign="top"><td><code>con</code></td> <td> <p>a connection.</p> </td></tr> </table> <h3>Details</h3> <p><code>stdin()</code>, <code>stdout()</code> and <code>stderr()</code> 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 <code>"terminal"</code> which cannot be opened or closed, and are read-only, write-only and write-only respectively. The <code>stdout()</code> and <code>stderr()</code> connections can be re-directed by <code><a href="sink.html">sink</a></code> (and in some circumstances the output from <code>stdout()</code> can be split: see the help page). </p> <p>The encoding for <code><a href="showConnections.html">stdin</a>()</code> when redirected can be set by the command-line flag <span class="option">--encoding</span>. </p> <p><code>nullfile()</code> returns filename of the null device (<code>"/dev/null"</code> on Unix, <code>"nul:"</code> on Windows). </p> <p><code>showConnections</code> returns a matrix of information. If a connection object has been lost or forgotten, <code>getConnection</code> 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 <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> level object referring to the connection it will be closed automatically at the next garbage collection (except for <code><a href="gzcon.html">gzcon</a></code> connections). </p> <p><code>closeAllConnections</code> closes (and destroys) all user connections, restoring all <code><a href="sink.html">sink</a></code> diversions as it does so. </p> <p><code>isatty</code> returns true if the connection is one of the class <code>"terminal"</code> connections and it is apparently connected to a terminal, otherwise false. This may not be reliable in embedded applications, including GUI consoles. </p> <h3>Value</h3> <p><code>stdin()</code>, <code>stdout()</code> and <code>stderr()</code> return connection objects. </p> <p><code>showConnections</code> returns a character matrix of information with a row for each connection, by default only for open non-standard connections. </p> <p><code>getConnection</code> returns a connection object, or <code>NULL</code>. </p> <h3>Note</h3> <p><code>stdin()</code> refers to the ‘console’ and not to the C-level ‘<span class="file">stdin</span>’ of the process. The distinction matters in GUI consoles (which may not have an active ‘<span class="file">stdin</span>’, and if they do it may not be connected to console input), and also in embedded applications. If you want access to the C-level file stream ‘<span class="file">stdin</span>’, use <code><a href="connections.html">file</a>("stdin")</code>. </p> <p>When <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> is reading a script from a file, the <em>file</em> is the ‘console’: this is traditional usage to allow in-line data (see ‘An Introduction to R’ for an example). </p> <h3>See Also</h3> <p><code><a href="connections.html">connections</a></code></p> <h3>Examples</h3> <pre> 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) ## End(Not run) c(isatty(stdin()), isatty(stdout()), isatty(stderr())) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>