__getcwd.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <html>
  2. <head>
  3. <title>__getcwd</title>
  4. <body bgcolor=#ffffff>
  5. <h2 align=center>__getcwd</h2>
  6. <h4 align=center>OS/161 Reference Manual</h4>
  7. <h3>Name</h3>
  8. __getcwd - get name of current working directory (backend)
  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. __getcwd(char *<em>buf</em>, size_t <em>buflen</em>);
  16. <h3>Description</h3>
  17. The name of the current directory is computed and stored in
  18. <em>buf</em>, an area of size <em>buflen</em>. The length of data
  19. actually stored, which must be non-negative, is returned.
  20. <p>
  21. Note: this call behaves like <A HREF=read.html>read</A> - the name
  22. stored in <em>buf</em> is not 0-terminated.
  23. <p>
  24. This function is not meant to be called except by the C library;
  25. application programmers should use <A HREF=../libc/getcwd.html>getcwd</A>
  26. instead.
  27. <h3>Return Values</h3>
  28. On success, __getcwd returns the length of the data returned.
  29. On error, -1 is returned, and <A HREF=errno.html>errno</A>
  30. is set according to the error encountered.
  31. <h3>Errors</h3>
  32. The following error codes should be returned under the conditions
  33. given. Other error codes may be returned for other errors not
  34. mentioned here.
  35. <blockquote><table width=90%>
  36. <td width=10%>&nbsp;</td><td>&nbsp;</td></tr>
  37. <tr><td>ENOENT</td> <td>A component of the pathname no longer exists.</td></tr>
  38. <tr><td>EIO</td> <td>A hard I/O error occurred.</td></tr>
  39. <tr><td>EFAULT</td> <td><em>buf</em> points to an invalid address.</td></tr>
  40. </table></blockquote>
  41. </body>
  42. </html>