truncate {Rstreams}R Documentation

Truncate a Binary Stream

Description

Truncates a binary stream at its current position.

Usage

  truncate(stream)

Arguments

stream a stream previously opened in write mode.

Details

This function will truncate the file at the current position. Any data after this position will be deleted.

Value

The new size of the stream.

See Also

openstream

Examples

s <- openstream("mydata", "write")
# Write the bytes from 1 to 10 to the file, and truncate after them
# to be sure it is only 10 bytes long.
writeint(s, 1:10, 1)
truncate(s)
closestream(s)