collUtils (version 1.0.5)

truncateEndOfFile: Truncate n bytes from end of file

Description

Truncate n bytes from end of file

Usage

truncateEndOfFile(filename, len)

Arguments

filename
character. Filename.
len
numeric. Number of bytes to truncate

Examples

Run this code
## Not run: 
# fn = tempfile()
# f = file(fn, "wb")
# writeBin("a", f)
# writeBin("b", f)
# writeBin("c", f)
# close(f)
# file.info(fn)$size == 6
# truncateEndOfFile(fn, 1)
# file.info(fn)$size == 5
# ## End(Not run)

Run the code above in your browser using DataLab