AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox

01.01.2013 Views

I� i -� ·-

GETCWD ( 3C } GETCWD ( 3C ) NAME getcwd - get path-name of current working directory SYNOPSIS char *getcwd (buf, size) char *huf; int size; DESCRIPTION Getcwd returns a pointer to the current directory path-name. The value of size must be at least two greater than the length of the path-name to be returned. If buf is a NULL pointer, getcwd will obtain size bytes of space using malloc(3C). In this case, the pointer returned by getcwd may be used as the argument in a subsequent call to free. The function is implemented by using popen(3S) to pipe the output of the pwd(l) command into the specified string space. EXAMPLE char *cwd, *getcwd(); if ((cwd = getcwd((char *)NULL, 64)) == NULL) { perror(''pwd"); exit( I); } printf("%s\n", cwd); SEE ALSO pwd(l), malloc(3C), popen(3S). DIAGNOSTICS Returns NULL with errno set if size is not large enough, or if an error occurs in a lower-level function. - 1 -

I�<br />

i -�<br />

·-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!