06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

pHILE+ <strong>System</strong> <strong>Calls</strong> truncate_f<br />

truncate_f Changes the size of a named file.<br />

#include <br />

unsigned long truncate_f(<br />

char *name, /* file pathname */<br />

unsigned long length /* file size in bytes */<br />

)<br />

Volume Types<br />

Description<br />

Arguments<br />

Return Value<br />

pHILE+, MS-DOS, and NFS volumes.<br />

truncate_f() causes the file specified by name to have a size (in bytes) equal to<br />

length. If the file was previously longer than length, the extra bytes are<br />

truncated. If it was shorter, the bytes between the old and new lengths are filled<br />

with zeroes.<br />

Unlike annex_f(), this system call changes both the logical and the physical file<br />

size. (annex_f() changes only the physical file size.)<br />

On pHILE+ or MS-DOS volumes, the file must not be open. If this is violated, the<br />

error E_FOPEN is returned.<br />

name Points to the null-terminated pathname of the file.<br />

length Specifies the new file size in bytes.<br />

This system call returns 0 on success or an error code on failure.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 2-117<br />

2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!