Changes the file size.
#include <unistd.h> int chsize64 ( int fildes, size64_t size);
(IN) Specifies a file descriptor.
(IN) Specifies the file size. If size is larger than the current size, the file is extended. If size is smaller than the current size, the file is truncated.
If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following values:
The chsize64 function changes the size of the file associated with the fildes parameter to the exact size specified by the size parameter. It can truncate or extend the file, depending on the value of size compared to the file’s original size.
The mode in which the file was opened must allow writing.
If chsize64 extends the file, it appends the null-terminating characters (\0). If it truncates the file, all data beyond the new end-of-file indicator is lost.
If chsize64 fails, the size of the file remains unchanged.
The chsize64 function is equivalent to chsize except that it handles files larger than 2 GB.