1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <html>
- <head>
- <title>ftruncate</title>
- <body bgcolor=#ffffff>
- <h2 align=center>ftruncate</h2>
- <h4 align=center>OS/161 Reference Manual</h4>
- <h3>Name</h3>
- ftruncate - set size of a file
- <h3>Library</h3>
- Standard C Library (libc, -lc)
- <h3>Synopsis</h3>
- #include <unistd.h><br>
- <br>
- int<br>
- ftruncate(int <em>fd</em>, off_t <em>filesize</em>);
- <h3>Description</h3>
- ftruncate forcibly sets the size of the file referred to by
- <em>fd</em> to <em>filesize</em>. If this expands the file, the new
- data appears as if it is zero-filled. If this shrinks the file, the
- excess data is discarded.
- <p>
- The file must be open for write.
- <h3>Return Values</h3>
- On success, ftruncate returns 0. On error, -1 is returned, and
- <A HREF=errno.html>errno</A> is set according to the error
- encountered.
- <h3>Errors</h3>
- The following error codes should be returned under the conditions
- given. Other error codes may be returned for other errors not
- mentioned here.
- <blockquote><table width=90%>
- <td width=10%> </td><td> </td></tr>
- <tr><td>EBADF</td> <td><em>fd</em> is not a valid file handle, or
- it is not open for writing.</td></tr>
- <tr><td>EIO</td> <td>A hard I/O error occurred.</td></tr>
- <tr><td>EFAULT</td> <td><em>buf</em> points to an invalid address.</td></tr>
- </table></blockquote>
- </body>
- </html>
|