1Tcl_GetOpenFile(3) Tcl Library Procedures Tcl_GetOpenFile(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_GetOpenFile - Return a FILE* for a channel registered in the given
9 interpreter (Unix only)
10
12 #include <tcl.h>
13
14 int
15 Tcl_GetOpenFile(interp, chanID, 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 *chanID (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 was not
31 opened for the access indicated by
32 write.
33
34 ClientData *filePtr (out) Points to word in which to store
35 pointer to FILE structure for the
36 file given by chanID.
37_________________________________________________________________
38
39
41 Tcl_GetOpenFile takes as argument a file identifier of the form
42 returned by the open command and returns at *filePtr a pointer to the
43 FILE structure for the file. The write argument indicates whether the
44 FILE pointer will be used for reading or writing. In some cases, such
45 as a channel that connects to a pipeline of subprocesses, different
46 FILE pointers will be returned for reading and writing. Tcl_GetOpenā
47 File normally returns TCL_OK. If an error occurs in Tcl_GetOpenFile
48 (e.g. chanID did not make any sense or checkUsage was set and the file
49 was not opened for the access specified by write) then TCL_ERROR is
50 returned and the interpreter's result will contain an error message.
51 In the current implementation checkUsage is ignored and consistency
52 checks are always performed.
53
54 Note that this interface is only supported on the Unix platform.
55
56
58 channel, file handle, permissions, pipeline, read, write
59
60
61
62Tcl 8.0 Tcl_GetOpenFile(3)