1Tcl_GetCwd(3) Tcl Library Procedures Tcl_GetCwd(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_GetCwd, Tcl_Chdir - manipulate the current working directory
9
11 #include <tcl.h>
12
13 char *
14 Tcl_GetCwd(interp, bufferPtr)
15
16 int
17 Tcl_Chdir(path)
18
20 Tcl_Interp *interp (in) Interpreter in which to report an
21 error, if any.
22
23 Tcl_DString *bufferPtr (in/out) This dynamic string is used to
24 store the current working direc‐
25 tory. At the time of the call it
26 should be uninitialized or free.
27 The caller must eventually call
28 Tcl_DStringFree to free up any‐
29 thing stored here.
30
31 char *path (in) File path in UTF-8 format.
32_________________________________________________________________
33
34
36 These procedures may be used to manipulate the current working direc‐
37 tory for the application. They provide C-level access to the same
38 functionality as the Tcl pwd command.
39
40 Tcl_GetCwd returns a pointer to a string specifying the current direc‐
41 tory, or NULL if the current directory could not be determined. If
42 NULL is returned, an error message is left in the interp's result.
43 Storage for the result string is allocated in bufferPtr; the caller
44 must call Tcl_DStringFree() when the result is no longer needed. The
45 format of the path is UTF-8.
46
47 Tcl_Chdir changes the applications current working directory to the
48 value specified in path. The format of the passed in string must be
49 UTF-8. The function returns -1 on error or 0 on success.
50
51
53 pwd
54
55
56
57Tcl 8.1 Tcl_GetCwd(3)