Go to main content

man pages section 3: Extended Library Functions, Volume 1

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Tcl_GetCwd (3tcl)

Name

Tcl_GetCwd - manipulate the current working directory

Synopsis

#include <tcl.h>

char *
Tcl_GetCwd(interp, bufferPtr)

int
Tcl_Chdir(path)

Description

Tcl_GetCwd(3tcl)            Tcl Library Procedures            Tcl_GetCwd(3tcl)



______________________________________________________________________________

NAME
       Tcl_GetCwd, Tcl_Chdir - manipulate the current working directory

SYNOPSIS
       #include <tcl.h>

       char *
       Tcl_GetCwd(interp, bufferPtr)

       int
       Tcl_Chdir(path)

ARGUMENTS
       Tcl_Interp *interp (in)              Interpreter  in which to report an
                                            error, if any.

       Tcl_DString *bufferPtr (in/out)      This dynamic  string  is  used  to
                                            store  the  current working direc-
                                            tory.  At the time of the call  it
                                            should  be  uninitialized or free.
                                            The caller  must  eventually  call
                                            Tcl_DStringFree  to  free  up any-
                                            thing stored here.

       char *path (in)                      File path in UTF-8 format.
______________________________________________________________________________


DESCRIPTION
       These procedures may be used to manipulate the current  working  direc-
       tory  for  the  application.   They  provide C-level access to the same
       functionality as the Tcl pwd command.

       Tcl_GetCwd returns a pointer to a string specifying the current  direc-
       tory,  or  NULL  if  the current directory could not be determined.  If
       NULL is returned, an error message is  left  in  the  interp's  result.
       Storage  for  the  result  string is allocated in bufferPtr; the caller
       must call Tcl_DStringFree() when the result is no longer  needed.   The
       format of the path is UTF-8.

       Tcl_Chdir  changes  the  applications  current working directory to the
       value specified in path.  The format of the passed in  string  must  be
       UTF-8.  The function returns -1 on error or 0 on success.


KEYWORDS
       pwd



ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | runtime/tcl-8    |
       +---------------+------------------+
       |Stability      | Uncommitted      |
       +---------------+------------------+

NOTES
       Source  code  for open source software components in Oracle Solaris can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This     software     was    built    from    source    available    at
       https://github.com/oracle/solaris-userland.   The  original   community
       source was downloaded from  http://prdownloads.sourceforge.net/tcl/tcl-
       core8.6.7-src.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.tcl.tk/.



Tcl                                   8.1                     Tcl_GetCwd(3tcl)