| 1 |
'\" |
| 2 |
'\" Copyright (c) 1998-1999 Scriptics Corporation |
| 3 |
'\" |
| 4 |
'\" See the file "license.terms" for information on usage and redistribution |
| 5 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 6 |
'\" |
| 7 |
.TH Tcl_GetCwd 3 8.1 Tcl "Tcl Library Procedures" |
| 8 |
.so man.macros |
| 9 |
.BS |
| 10 |
.SH NAME |
| 11 |
Tcl_GetCwd, Tcl_Chdir \- manipulate the current working directory |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
\fB#include <tcl.h>\fR |
| 15 |
.sp |
| 16 |
char * |
| 17 |
\fBTcl_GetCwd\fR(\fIinterp\fR, \fIbufferPtr\fR) |
| 18 |
.sp |
| 19 |
int |
| 20 |
\fBTcl_Chdir\fR(\fIdirName\fR) |
| 21 |
.SH ARGUMENTS |
| 22 |
.AS Tcl_DString *bufferPtr in/out |
| 23 |
.AP Tcl_Interp *interp in |
| 24 |
Interpreter in which to report an error, if any. |
| 25 |
.AP Tcl_DString *bufferPtr in/out |
| 26 |
This dynamic string is used to store the current working directory. |
| 27 |
At the time of the call it should be uninitialized or free. The |
| 28 |
caller must eventually call \fBTcl_DStringFree\fR to free up |
| 29 |
anything stored here. |
| 30 |
.AP "const char" *dirName in |
| 31 |
File path in UTF\-8 format. |
| 32 |
.BE |
| 33 |
|
| 34 |
.SH DESCRIPTION |
| 35 |
.PP |
| 36 |
These procedures may be used to manipulate the current working |
| 37 |
directory for the application. They provide C\-level access to |
| 38 |
the same functionality as the Tcl \fBpwd\fR command. |
| 39 |
.PP |
| 40 |
\fBTcl_GetCwd\fR returns a pointer to a string specifying the current |
| 41 |
directory, or NULL if the current directory could not be determined. |
| 42 |
If NULL is returned, an error message is left in the \fIinterp\fR's result. |
| 43 |
Storage for the result string is allocated in bufferPtr; the caller |
| 44 |
must call \fBTcl_DStringFree()\fR when the result is no longer needed. |
| 45 |
The format of the path is UTF\-8. |
| 46 |
.PP |
| 47 |
\fBTcl_Chdir\fR changes the applications current working directory to |
| 48 |
the value specified in \fIdirName\fR. The format of the passed in string |
| 49 |
must be UTF\-8. The function returns -1 on error or 0 on success. |
| 50 |
|
| 51 |
.SH KEYWORDS |
| 52 |
pwd |