getcwd - int r if(buflen< 1 errno = EINVAL return NULL r...

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 < 1) { errno = EINVAL; return NULL; } r = __getcwd(buf, buflen-1); if (r < 0) { return NULL; } buf[r] = 0; return buf; }...
View Full Document

This note was uploaded on 11/10/2009 for the course CS 536 taught by Professor Lums during the Spring '09 term at Indiana.

Ask a homework question - tutors are online