chsize - change size of satellite file


chsize (path,size)
char *path;
int size;


path points to a path name of a file. chsize changes the size of that file according to size , the argument that specifies the number of 512 byte blocks to allocate the file.

If the file is currently smaller than size, chsize reallocates space to the file, adding the required number of blocks. If a file is currently larger than size but its contents require no more than size blocks, it is truncated to size. If size is smaller than the number of blocks required by the contents of the file, file is only truncated to the minimum size that will accommodate the contents of the file.

chsize will fail and no file size will change if one or more of the following are true:


On successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.


chmod(2F) , create(2F)