1GETWD(P) POSIX Programmer's Manual GETWD(P)
2
3
4
6 getwd - get the current working directory pathname (LEGACY)
7
9 #include <unistd.h>
10
11 char *getwd(char *path_name);
12
13
15 The getwd() function shall determine an absolute pathname of the cur‐
16 rent working directory of the calling process, and copy a string con‐
17 taining that pathname into the array pointed to by the path_name argu‐
18 ment.
19
20 If the length of the pathname of the current working directory is
21 greater than ({PATH_MAX}+1) including the null byte, getwd() shall fail
22 and return a null pointer.
23
25 Upon successful completion, a pointer to the string containing the
26 absolute pathname of the current working directory shall be returned.
27 Otherwise, getwd() shall return a null pointer and the contents of the
28 array pointed to by path_name are undefined.
29
31 No errors are defined.
32
33 The following sections are informative.
34
36 None.
37
39 For applications portability, the getcwd() function should be used to
40 determine the current working directory instead of getwd().
41
43 Since the user cannot specify the length of the buffer passed to
44 getwd(), use of this function is discouraged. The length of a pathname
45 described in {PATH_MAX} is file system-dependent and may vary from one
46 mount point to another, or might even be unlimited. It is possible to
47 overflow this buffer in such a way as to cause applications to fail, or
48 possible system security violations.
49
50 It is recommended that the getcwd() function should be used to deter‐
51 mine the current working directory.
52
54 This function may be withdrawn in a future version.
55
57 getcwd() , the Base Definitions volume of IEEE Std 1003.1-2001,
58 <unistd.h>
59
61 Portions of this text are reprinted and reproduced in electronic form
62 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
63 -- Portable Operating System Interface (POSIX), The Open Group Base
64 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
65 Electrical and Electronics Engineers, Inc and The Open Group. In the
66 event of any discrepancy between this version and the original IEEE and
67 The Open Group Standard, the original IEEE and The Open Group Standard
68 is the referee document. The original Standard can be obtained online
69 at http://www.opengroup.org/unix/online.html .
70
71
72
73IEEE/The Open Group 2003 GETWD(P)