Mono Class Library: Mono.Unix.Native.Syscall Overview | MembersMono.Unix.Native.Syscall.truncate Method |
Truncate or extend a file to a specified length. [Edit]
|
On success, zero is returned. On error, -1 is returned and Stdlib.GetLastError returns the translated error.
Usage
The truncate() system call succeeds unless:
Error Details Errno.ENOTDIR A component of the path prefix is not a directory.
Errno.ENAMETOOLONG A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
Errno.ENOENT The named file does not exist.
Errno.EACCES Search permission is denied for a component of the path prefix.
Errno.EACCES The named file is not writable by the user.
Errno.ELOOP Too many symbolic links were encountered in translating the pathname.
Errno.EISDIR The named file is a directory.
Errno.EROFS The named file resides on a read-only file system.
Errno.ETXTBSY The file is a pure procedure (shared text) file that is being executed.
Errno.EIO An I/O error occurred updating the inode.
Errno.EFAULT The path argument points outside the process's allocated address space.
The ftruncate() system call succeeds unless:
[Edit]
Error Details Errno.EBADF The fd argument is not a valid descriptor.
Errno.EINVAL The fd argument references a socket, not a file.
Errno.EINVAL The fd descriptor is not open for writing.
The truncate() system call causes the file named by path or referenced by fd to be truncated or extended to length bytes in size. If the file was larger than this size, the extra data is lost. If the file was smaller than this size, it will be extended as if by writing bytes with the value zero. With ftruncate(), the file must be open for writing. [Edit]
Namespace: Mono.Unix.Native
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0