close.html 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <html>
  2. <head>
  3. <title>close</title>
  4. <body bgcolor=#ffffff>
  5. <h2 align=center>close</h2>
  6. <h4 align=center>OS/161 Reference Manual</h4>
  7. <h3>Name</h3>
  8. close - close file
  9. <h3>Library</h3>
  10. Standard C Library (libc, -lc)
  11. <h3>Synopsis</h3>
  12. #include &lt;unistd.h&gt;<br>
  13. <br>
  14. int<br>
  15. close(int <em>fd</em>);
  16. <h3>Description</h3>
  17. The file handle <em>fd</em> is closed. The same file handle may then
  18. be returned again from <A HREF=open.html>open</A>,
  19. <A HREF=dup2.html>dup2</A>, <A HREF=pipe.html>pipe</A>, or similar
  20. calls.
  21. <p>
  22. Other file handles are not affected in any way, even if they are
  23. attached to the same file.
  24. <p>
  25. <h3>Return Values</h3>
  26. On success, close returns 0. On error, -1 is returned, and
  27. <A HREF=errno.html>errno</A> is set according to the error
  28. encountered.
  29. <h3>Errors</h3>
  30. The following error codes should be returned under the conditions
  31. given. Other error codes may be returned for other errors not
  32. mentioned here.
  33. <blockquote><table width=90%>
  34. <tr><td width=10%>&nbsp;</td><td>&nbsp;</td></tr>
  35. <tr><td>EBADF</td> <td><em>fd</em> is not a valid file handle.</td></tr>
  36. <tr><td>EIO</td> <td>A hard I/O error occurred.</td></tr>
  37. </table></blockquote>
  38. </body>
  39. </html>