SYNOPSIS
#include <unistd.h>
int truncate(const char *pathname, off_t length);
int truncate64(const char *pathname, off64_t length);
DESCRIPTION
The
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.
The
PARAMETERS
RETURN VALUES
If successful,
- EACCES
-
A component of the path prefix denies search permission, or write permission is denied on the file.
- EINTR
-
A signal interrupted the call.
- EINVAL
-
The length argument was less than 0.
- EISDIR
-
The named file is a directory.
- ENOENT
-
A component of pathname does not name an existing file, or pathname is an empty string.
- ENOTDIR
-
A component of the path prefix of path is not a directory.
- ETXTBSY
-
The file exists, mandatory file/record locking is set, and there are outstanding record locks on the file.
The file referred to by pathname is a pure procedure (shared text) file that is being executed.
CONFORMANCE
UNIX 98.
MULTITHREAD SAFETY LEVEL
MT-Safe.
PORTING ISSUES
None.
AVAILABILITY
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
SEE ALSO
- Functions:
fcntl() ,ftruncate() ,open()
- Miscellaneous:
- lf64
PTC MKS Toolkit 10.5 Documentation Build 40.