Movatterモバイル変換


[0]ホーム

URL:


rawConnection {base}R Documentation

Raw Connections

Description

Input and output raw connections.

Usage

rawConnection(object, open = "r")rawConnectionValue(con)

Arguments

object

character or raw vector. A description of the connection.For an input this is anR raw vector object, and for an outputconnection the name for the connection.

open

character. Any of the standard connection open modes.

con

an output raw connection.

Details

An input raw connection is opened and the raw vector is copiedat the time the connection object is created, andclosedestroys the copy.

An output raw connection is opened and creates anR raw vectorinternally. The raw vector can be retrievedviarawConnectionValue.

If a connection is open for both input and output the initial rawvector supplied is copied when the connections is open

Value

ForrawConnection, a connection object of class"rawConnection" which inherits from class"connection".

ForrawConnectionValue, a raw vector.

Note

As output raw connections keep the internal raw vector up to datecall-by-call, they are relatively expensive to use (althoughover-allocation is used), and it may be better to use an anonymousfile() connection to collect output.

On (rare) platforms wherevsnprintf does not return the needed lengthof output there is a 100,000 character limit on the length of line foroutput connections: longer lines will be truncated with a warning.

See Also

connections,showConnections.

Examples

zz <- rawConnection(raw(0), "r+") # start with empty raw vectorwriteBin(LETTERS, zz)seek(zz, 0)readLines(zz) # raw vector has embedded nulsseek(zz, 0)writeBin(letters[1:3], zz)rawConnectionValue(zz)close(zz)

[Packagebase version 4.6.0Index]

[8]ページ先頭

©2009-2025 Movatter.jp