openstream             package:Rstreams             R Documentation

_O_p_e_n _o_r _C_l_o_s_e _a _S_t_r_e_a_m

_D_e_s_c_r_i_p_t_i_o_n:

     Open or close a file for binary reading and writing.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

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.

_V_a_l_u_e:

     an object of the stream class is returned by `openstream'.

_S_e_e _A_l_s_o:

     `readint', `writeint', `seekstream'

_E_x_a_m_p_l_e_s:

     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")

