ftruncate(3C) DG/UX 5.4R3.00 ftruncate(3C)
NAME
ftruncate - set a file to a specified length
SYNOPSIS
#include <unistd.h>
int ftruncate (int fildes, offt length);
DESCRIPTION
The file whose name is referenced by the descriptor fildes has its
size set to length bytes.
If the file was previously longer than length, bytes past length will
no longer be accessible. If it was shorter, bytes from the EOF
before the call to the EOF after the call will be read in as zeros.
The file descriptor filedes must have been previously opened for
writing.
ftruncate fails if one or more of the following are true:
EAGAIN The file exists, mandatory file/record locking is
set, and there are outstanding record locks on the
file [see chmod(2)].
EBADF fildes is not a file descriptor open for writing.
EINTR A signal was caught during execution of the
ftruncate routine.
EIO An I/O error occurred while reading from or writing
to the file system.
ENOLINK fildes points to a remote machine and the link to
that machine is no longer active.
EINVAL fildes does not correspond to an ordinary file.
Considerations for Threads Programming
+----------+-----------------------------+
| | async- |
|function | reentrant cancel cancel |
| | point safe |
+----------+-----------------------------+
|ftruncate | Y Y N |
+----------+-----------------------------+
SEE ALSO
fcntl(2), open(2), truncate(2), reentrant(3).
DIAGNOSTICS
Upon successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
Licensed material--property of copyright holder(s) 1