\name{sinkSetup, sinkRetrieve}
\alias{sinkSetup}
\alias{sinkRetrieve}

\title{Capture and retrieve screen output}
\description{
  \code{sinkSetup} establishes temporary files to capture output that
  would normally be directed toward the screen, and redirects both
  standard and error output to these files. \code{sinkRetrieve}
  retrieves the output, and removes screen redirections so output again
  appears on the screen.
}
\usage{
sinkSetup()
sinkRetrieve()
}

\details{
  These functions are used to redirect and then retrieve screen
  output. Redirection is to objects created with \code{\link{file}}, with
  no arguments (i.e., a temporary file, unlinked from the file
  system). Both standard output and error output are redirected.

  User-level calls of \code{\link{sink}} between calls to
  \code{sinkSetup} and \code{sinkRetrieve} may confuse screen
  (especially error) capture, likely resulting in warnings when
  \code{sinkRetrieve} is called. 
}
\value{
  \code{sinkRetrieve} returns an object of
  \code{\link{SinkOutput-class}}, the slots of which contain vectors of
  the lines of text directed toward the screen. 
}
\author{MT Morgan}
\examples{
library(RWebServices)

sinkSetup()
ls()
try( fails())
f <- function() stop("fails in function f")
try( f())
sinkRetrieve()
}
\keyword{programming}
\keyword{documentation}