INtime SDK Help

Extends or truncates the size of a file to the specified length.

#include <io.h>

int chsize (int handle, long size);


Descriptor referring to an open file. The file must be open in a mode that permits writing.
New length of file in bytes.


If the file is extended, null characters \0 are appended. If the file is truncated, all data from the end of the shortened file to the original length of the file is lost.

The directory update is done when a file is closed. Consequently, while a program is running, requests to determine the amount of freedisk space may receive inaccurate results.

Return Values

0 (zero).
-1    the function sets errno to one of these values:
EACCES Specified file is locked against access.
EBADF Specified file is read-only or an invalid file descriptor.
ENOSPC No space is left on device.


Versions Defined in Include Link to
INtime 3.0 intime/rt/include/io.h io.h clib.lib

See Also

close, creat