Sunday, November 2, 2014

Truncating Files

ftruncate() and truncate() trim the file to the length specified.  ftruncate() works on file descriptor and truncate() works on a pathname.

If the length given is larger than the current file size, the file is extended in a fashion similar to lseek+write.  The extended length will be filled with zeros.

No comments: