getcwd - { int r; if (buflen < 1) { errno =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <unistd.h> #include <errno.h> /* * POSIX C function: retrieve current working directory. * Uses the system call __getcwd(), which does essentially * all the work. */ char * getcwd(char *buf, size_t buflen)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { int r; if (buflen &lt; 1) { errno = EINVAL; return NULL; } r = __getcwd(buf, buflen-1); if (r &lt; 0) { return NULL; } buf[r] = 0; return buf; }...
View Full Document

Ask a homework question - tutors are online