openstream {Rstreams}R Documentation

Open or Close a Stream

Description

Open or close a file for binary reading and writing.

Usage

stream <- openstream(filename, mode = "read")
closestream(stream)

Arguments

filename a string containing a single file name. Tilde-expansion is performed on the file name.
mode the mode in which to open the file, either "read" or "write".
stream a previously opened stream, or the special string "all" to close all streams.

Value

an object of the stream class is returned by openstream.

See Also

readint, writeint, seekstream

Examples

s <- openstream("mydata", "write")
s
# Write the bytes from 1 to 100 to the file
writeint(s, 1:100, 1)
summary(s)
closestream(s)

unlink("mydata")