Rev 80439 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/writeLines.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2021 R Core Team% Distributed under GPL 2 or later\name{writeLines}\alias{writeLines}\title{Write Lines to a Connection}\description{Write text lines to a connection.}\usage{writeLines(text, con = stdout(), sep = "\n", useBytes = FALSE)}\arguments{\item{text}{A character vector}\item{con}{A \link{connection} object or a character string.}\item{sep}{character string. A string to be written to the connectionafter each line of text.}\item{useBytes}{logical. See \sQuote{Details}.}}\details{If the \code{con} is a character string, the function calls\code{\link{file}} to obtain a file connection which is opened forthe duration of the function call.(\link{tilde expansion} of the file path is done by \code{file}.)If the connection is open it is written from its current position.If it is not open, it is opened for the duration of the call in\code{"wt"} mode and then closed again.Normally \code{writeLines} is used with a text-mode connection, and thedefault separator is converted to the normal separator for thatplatform (LF on Unix/Linux, CRLF on Windows). For more control, opena binary connection and specify the precise value you want written tothe file in \code{sep}. For even more control, use\code{\link{writeChar}} on a binary connection.\code{useBytes} is for expert use. Normally (when false) characterstrings with marked encodings are converted to the current encodingbefore being passed to the connection (which might do furtherre-encoding). \code{useBytes = TRUE} suppresses the re-encoding ofmarked strings so they are passed byte-by-byte to the connection:this can be useful when strings have already been re-encoded bye.g.\sspace{}\code{\link{iconv}}. (It is invoked automatically for stringswith marked encoding \code{"bytes"}.)}\seealso{\code{\link{connections}}, \code{\link{writeChar}}, \code{\link{writeBin}},\code{\link{readLines}}, \code{\link{cat}}}\keyword{file}\keyword{connection}