📄 splitpath.3
字号:
'\"'\" Copyright (c) 1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) SplitPath.3 1.4 96/08/19 14:59:35'\" .so man.macros.TH Tcl_SplitPath 3 7.5 Tcl "Tcl Library Procedures".BS.SH NAMETcl_SplitPath, Tcl_JoinPath, Tcl_GetPathType \- manipulate platform-dependent file paths.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.sp\fBTcl_SplitPath\fR(\fIpath, argcPtr, argvPtr\fR).spchar *\fBTcl_JoinPath\fR(\fIargc, argv, resultPtr\fR).spTcl_PathType\fBTcl_GetPathType\fR(\fIpath\fR).SH ARGUMENTS.AS Tcl_DString ***argvPtr.AP char *path inFile path in a form appropriate for the current platform (see the\fBfilename\fR manual entry for acceptable forms for path names)..AP int *argcPtr outFilled in with number of path elements in \fIpath\fR..AP char ***argvPtr out\fI*argvPtr\fR will be filled in with the address of an array ofpointers to the strings that are the extracted elements of \fIpath\fR.There will be \fI*argcPtr\fR valid entries in the array, followed bya NULL entry..AP int argc inNumber of elements in \fIargv\fR..AP char **argv inArray of path elements to merge together into a single path..AP Tcl_DString *resultPtr in/outA pointer to an initialized \fBTcl_DString\fR to which the result of\fBTcl_JoinPath\fR will be appended..BE.SH DESCRIPTION.PPThese procedures may be used to disassemble and reassemble filepaths in a platform independent manner: they provide C-level access tothe same functionality as the \fBfile split\fR, \fBfile join\fR, and\fBfile pathtype\fR commands..PP\fBTcl_SplitPath\fR breaks a path into its constituent elements,returning an array of pointers to the elements using \fIargcPtr\fR and\fIargvPtr\fR. The area of memory pointed to by \fI*argvPtr\fR isdynamically allocated; in addition to the array of pointers, it alsoholds copies of all the path elements. It is the caller'sresponsibility to free all of this storage.For example, suppose that you have called \fBTcl_SplitPath\fR with thefollowing code:.CSint argc;char *path;char **argv;\&...Tcl_SplitPath(string, &argc, &argv);.CEThen you should eventually free the storage with a call like thefollowing:.CSTcl_Free((char *) argv);.CE.PP\fBTcl_JoinPath\fR is the inverse of \fBTcl_SplitPath\fR: it takes acollection of path elements given by \fIargc\fR and \fIargv\fR andgenerates a result string that is a properly constructed path. Theresult string is appended to \fIresultPtr\fR. \fIResultPtr\fR mustrefer to an initialized \fBTcl_DString\fR..PPIf the result of \fBTcl_SplitPath\fR is passed to \fBTcl_JoinPath\fR,the result will refer to the same location, but may not be in the sameform. This is because \fBTcl_SplitPath\fR and \fBTcl_JoinPath\fReliminate duplicate path separators and return a normalized form foreach platform..PP\fBTcl_GetPathType\fR returns the type of the specified \fIpath\fR,where \fBTcl_PathType\fR is one of \fBTCL_PATH_ABSOLUTE\fR,\fBTCL_PATH_RELATIVE\fR, or \fBTCL_PATH_VOLUME_RELATIVE\fR. See the\fBfilename\fR manual entry for a description of the path types foreach platform..SH KEYWORDSfile, filename, join, path, split, type
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -