chsize

Changes the file size

Local Servers:blocking
Remote Servers:blocking
Platform:NLM
Service:Operating System I/O

Syntax

  #include <unistd.h>  
   
  int chsize  (  
     int    handle,   
     LONG   size);
  

Parameters

handle
(IN) Specifies a file handle.
size
(IN) Specifies the file size.

Return Values

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.

Remarks

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.

See Also

eof, filelength