chsize
Changes the file size
#include <unistd.h>
int chsize (
int handle,
LONG size);
chsize returns a value of 0 if successful. It returns a value of -1 if an error occurs.
If an error occurs, errno is set to:
|
Decimal |
Constant |
Description |
|---|---|---|
|
4 |
EBADF |
Bad file number. |
|
6 |
EACCES |
Permission denied. |
|
12 |
ENOSPC |
No space left on device. |
If chsize does not complete successfully, NetWareErrno is set.
The chsize function changes the size of the file associated with the file handle. It can truncate or extend the file, depending on the value of size compared to the file’s original size.
The mode in which the file was opened must allow writing.
If chsize extends the file, it appends NULL characters (\0). If it truncates the file, all data beyond the new end-of-file indicator is lost.