United States-English |
|
|
HP-UX Reference > Ttruncate(2)HP-UX 11i Version 3: February 2007 |
|
NAMEftruncate, truncate — truncate a file to a specified length SYNOPSIS#include <unistd.h> int ftruncate(int fildes, off_t length); int truncate(const char *path, off_t length); DESCRIPTIONThe ftruncate() function causes the regular file referenced by fildes to have a size of length bytes. The truncate() function causes the regular file named by path to have a size of length bytes. The effect of ftruncate() and truncate() on other types of files is unspecified. If the file previously was larger than length, the extra data is lost. If it was previously shorter than length, bytes between the old and new lengths are read as zeroes. With ftruncate(), the file must be open for writing; for truncate(), the process must have write permission for the file. If the request would cause the file size to exceed the soft file size limit for the process, the request will fail and the implementation will generate the SIGXFSZ signal for the process. These functions do not modify the file offset for any open file descriptions associated with the file. On successful completion, if the file size is changed, these functions will mark for update the st_ctime and st_mtime fields of the file, and if the file is a regular file, the S_ISUID and S_ISGID bits of the file mode may be cleared. RETURN VALUEUpon successful completion, ftruncate()and truncate() returns 0. Otherwise a -1 is returned, and errno is set to indicate the error. ERRORSIf ftruncate() or truncate() fails, errno is set to one of the following values:
If ftruncate() fails, errno is set to one of the following values:
If truncate() fails, errno is set to one of the following values:
|
Printable version | ||
|