int ftruncate(int fildes, off_t length);
int ftruncate64(int fildes, off64_t length);
If the file was previously longer than length, bytes past length are lost. If the file was shorter, bytes between the old and the new length are read in as zeros. The effective user ID of the process must have write permission for the file, and the file must be open for writing.
These functions do not modify the file offset for any open file descriptors associated with the file. On successful completion, if the file size is changed, these functions mark the st_ctime and st_mtime fields of the file for update.
fildes is not a file descriptor that is open for writing.
The file is a regular file and its length is greater than the offset maximum established in the open file description associated with fildes.
A signal interrupted the call.
The length argument was less than 0.
The fildes argument references a file that was opened without write permission.
fildes does not correspond to an ordinary file.
The file exists, mandatory file/record locking is set, and there are outstanding record locks on the file.
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.3 Documentation Build 39.