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