Stream write functions       package:Rstreams       R Documentation

_W_r_i_t_e _B_i_n_a_r_y _D_a_t_a _t_o _a _S_t_r_e_a_m

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

     Writes binary data to the current position within a stream.

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

     writeint(stream, data, size = 4, swapbytes = FALSE)
     writefloat(stream, data, size = 8, swapbytes = FALSE)
     writecomplex(stream, data, size = 8, swapbytes = FALSE)
     writechar(stream, data, asciiz = FALSE)

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

  stream: a stream previously opened in write mode.

    data: a vector of data to write.

    size: the size of each item, in bytes.

swapbytes: whether to swap the byte order when writing.

  asciiz: whether to append an ascii zero to each character  vector
          component.

_D_e_t_a_i_l_s:

     Integers can be written in sizes of 1, 2, 4, and 8 bytes.  

     Numeric values can be written as `float', `double' or `long
     double'.

     Any size of character string that you can create can be written.

     If `swapbytes = TRUE', then when writing any multi-byte numbers,
     the byte order within the number will be swapped.  This allows you
     to write data for a machine that uses a different convention for
     numeric storage, i.e. write little-endian data from a big-endian
     machine, or vice versa.

     If `asciiz = FALSE' (the default), there is no separator between
     the components of a character vector being written.

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

     none

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

     `openstream', `readint'

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

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

