Declaration:
int chsize(long handle, long size);
Description
Changes the file size.
chsize changes the size of the file associated with 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 you open the file, must allow writing.
If chsize extends the file, it will append the null characters (\0). If it truncates the file, all data beyond the new end-of-file indicator will be lost.
Returned value
On success, chsize returns 0. On failure, it returns -1 and sets the errno global variable to one of the following values:
EACCESS Permission denied
EBADF Bad file number
ENOSPC No space left o
|