1Tcl_SplitPath(3)            Tcl Library Procedures            Tcl_SplitPath(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_SplitPath,  Tcl_JoinPath,  Tcl_GetPathType  -  manipulate platform-
9       dependent file paths
10

SYNOPSIS

12       #include <tcl.h>
13
14       Tcl_SplitPath(path, argcPtr, argvPtr)
15
16       char *
17       Tcl_JoinPath(argc, argv, resultPtr)
18
19       Tcl_PathType
20       Tcl_GetPathType(path)
21

ARGUMENTS

23       CONST char * CONST         *argvPtr(in)
24                                            File path in  a  form  appropriate
25                                            for  the current platform (see the
26                                            filename manual entry for  accept‐
27                                            able forms for path names).
28
29       int           *argcPtr     (out)     Filled in with number of path ele‐
30                                            ments in path.
31
32       CONST char    ***argvPtr   (out)     *argvPtr will be  filled  in  with
33                                            the  address of an array of point‐
34                                            ers to the strings  that  are  the
35                                            extracted elements of path.  There
36                                            will be *argcPtr valid entries  in
37                                            the  array,  followed  by  a  NULL
38                                            entry.
39
40       int           argc         (in)      Number of elements in argv.
41
42       CONST char * CONST         *argv(in) Array of path  elements  to  merge
43                                            together into a single path.
44
45       Tcl_DString   *resultPtr   (in/out)  A   pointer   to   an  initialized
46                                            Tcl_DString to which the result of
47                                            Tcl_JoinPath will be appended.
48_________________________________________________________________
49
50

DESCRIPTION

52       These  procedures have been superceded by the objectified procedures in
53       the FileSystem man page, which are more efficient.
54
55       These procedures may be used to disassemble and reassemble  file  paths
56       in  a  platform  independent manner: they provide C-level access to the
57       same functionality as the file split, file join, and file pathtype com‐
58       mands.
59
60       Tcl_SplitPath breaks a path into its constituent elements, returning an
61       array of pointers to the elements using argcPtr and argvPtr.  The  area
62       of  memory pointed to by *argvPtr is dynamically allocated; in addition
63       to the array of pointers, it also holds copies of  all  the  path  ele‐
64       ments.   It is the caller's responsibility to free all of this storage.
65       For example, suppose that you have called Tcl_SplitPath with  the  fol‐
66       lowing code:
67              int argc;
68              char *path;
69              char **argv;
70              ...
71              Tcl_SplitPath(string, &argc, &argv);
72       Then  you  should eventually free the storage with a call like the fol‐
73       lowing:
74              Tcl_Free((char *) argv);
75
76       Tcl_JoinPath is the inverse of Tcl_SplitPath: it takes a collection  of
77       path elements given by argc and argv and generates a result string that
78       is a properly constructed  path.  The  result  string  is  appended  to
79       resultPtr.  ResultPtr must refer to an initialized Tcl_DString.
80
81       If  the  result  of Tcl_SplitPath is passed to Tcl_JoinPath, the result
82       will refer to the same location, but may not be in the same form.  This
83       is because Tcl_SplitPath and Tcl_JoinPath eliminate duplicate path sep‐
84       arators and return a normalized form for each platform.
85
86       Tcl_GetPathType  returns  the  type  of  the  specified   path,   where
87       Tcl_PathType   is   one  of  TCL_PATH_ABSOLUTE,  TCL_PATH_RELATIVE,  or
88       TCL_PATH_VOLUME_RELATIVE.  See the filename manual entry for a descrip‐
89       tion of the path types for each platform.
90
91

KEYWORDS

93       file, filename, join, path, split, type
94
95
96
97Tcl                                   7.5                     Tcl_SplitPath(3)
Impressum