Learn R Programming

ctypesio (version 0.1.2)

write_hex: Write hexadecimal string as raw bytes

Description

Write hexadecimal string as raw bytes

Usage

write_hex(con, x, endian = NULL)

Value

If con is a connection then this connection is returned invisibly. If con is a raw vector then new data is appended to this vector

Arguments

con

Connection object or raw vector. When con is a raw vector, new data will be appended to the vector and returned. Connection objects can be created with file(), url(), rawConnection() or any of the other many connection creation functions.

x

vector to write

endian

Ordering of bytes within the file when reading multi-byte values. Possible values: 'big' or 'little'. Default: NULL indicates that endian option should be retrieved from the connection object if possible (where the user has used set_endian()) or otherwise will be set to "little"

See Also

Other data output functions: fprintf(), write_f64(), write_raw(), write_uint8(), write_utf8()

Examples

Run this code
con <- file(tempfile(), "wb")
write_hex(con, c("ff80", "0102"))
close(con)

Run the code above in your browser using DataLab