1Tcl_GetOpenFile(3) Tcl Library Procedures Tcl_GetOpenFile(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_GetOpenFile - Get a standard IO File * handle from a channel. (Unix
9 only)
10
12 #include <tcl.h>
13
14 int
15 Tcl_GetOpenFile(interp, string, write, checkUsage, filePtr)
16
17
19 Tcl_Interp *interp (in) Tcl interpreter from which file
20 handle is to be obtained.
21
22 CONST char *string (in) String identifying channel, such as
23 stdin or file4.
24
25 int write (in) Non-zero means the file will be
26 used for writing, zero means it
27 will be used for reading.
28
29 int checkUsage (in) If non-zero, then an error will be
30 generated if the file wasn't opened
31 for the access indicated by write.
32
33 ClientData *filePtr (out) Points to word in which to store
34 pointer to FILE structure for the
35 file given by string.
36_________________________________________________________________
37
38
40 Tcl_GetOpenFile takes as argument a file identifier of the form
41 returned by the open command and returns at *filePtr a pointer to the
42 FILE structure for the file. The write argument indicates whether the
43 FILE pointer will be used for reading or writing. In some cases, such
44 as a channel that connects to a pipeline of subprocesses, different
45 FILE pointers will be returned for reading and writing. Tcl_GetOpen‐
46 File normally returns TCL_OK. If an error occurs in Tcl_GetOpenFile
47 (e.g. string didn't make any sense or checkUsage was set and the file
48 wasn't opened for the access specified by write) then TCL_ERROR is
49 returned and the interpreter's result will contain an error message.
50 In the current implementation checkUsage is ignored and consistency
51 checks are always performed. │
52
53 Note that this interface is only supported on the Unix platform.
54
55
57 channel, file handle, permissions, pipeline, read, write
58
59
60
61Tcl 8.0 Tcl_GetOpenFile(3)