INtime SDK Help
chsize

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

#include <io.h>

int chsize (int handle, long size);

Parameters

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

Remarks

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).
Success.
-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.
Failure.

Requirements

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

See Also

close, creat