1Tcl_TranslateFileName(3) Tcl Library Procedures Tcl_TranslateFileName(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_TranslateFileName - convert file name to native form and replace
9 tilde with home directory
10
12 #include <tcl.h>
13
14 char *
15 Tcl_TranslateFileName(interp, name, bufferPtr)
16
18 Tcl_Interp *interp (in) Interpreter in which to report an
19 error, if any.
20
21 CONST char *name (in) File name, which may start with a
22 ``~''.
23
24 Tcl_DString *bufferPtr (in/out) If needed, this dynamic string is
25 used to store the new file name.
26 At the time of the call it should
27 be uninitialized or free. The
28 caller must eventually call
29 Tcl_DStringFree to free up any‐
30 thing stored here.
31_________________________________________________________________
32
33
35 This utility procedure translates a file name to a form suitable for
36 passing to the local operating system. It converts network names into
37 native form and does tilde substitution.
38
39 If Tcl_TranslateFileName has to do tilde substitution or translate the
40 name then it uses the dynamic string at *bufferPtr to hold the new
41 string it generates. After Tcl_TranslateFileName returns a non-NULL
42 result, the caller must eventually invoke Tcl_DStringFree to free any
43 information placed in *bufferPtr. The caller need not know whether or
44 not Tcl_TranslateFileName actually used the string; Tcl_TranslateFile‐
45 Name initializes *bufferPtr even if it doesn't use it, so the call to
46 Tcl_DStringFree will be safe in either case.
47
48 If an error occurs (e.g. because there was no user by the given name)
49 then NULL is returned and an error message will be left in the inter‐
50 preter's result. When an error occurs, Tcl_TranslateFileName frees the
51 dynamic string itself so that the caller need not call Tcl_DStringFree.
52
53 The caller is responsible for making sure that the interpreter's result
54 has its default empty value when Tcl_TranslateFileName is invoked.
55
56
58 filename
59
60
62 file name, home directory, tilde, translate, user
63
64
65
66Tcl 8.1 Tcl_TranslateFileName(3)