Debian Codegraph @

doc/GetOpnFl.3

raw
1 '\"
2 '\" Copyright (c) 1996-1997 Sun Microsystems, Inc.
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\"
7 .TH Tcl_GetOpenFile 3 8.0 Tcl "Tcl Library Procedures"
8 .so man.macros
9 .BS
10 .SH NAME
11 Tcl_GetOpenFile \- Return a FILE* for a channel registered in the given interpreter (Unix only)
12 .SH SYNOPSIS
13 .nf
14 \fB#include <tcl.h>\fR
15 .sp
16 int
17 \fBTcl_GetOpenFile\fR(\fIinterp, chanID, write, checkUsage, filePtr\fR)
18 .sp
19 .SH ARGUMENTS
20 .AS Tcl_Interp checkUsage out
21 .AP Tcl_Interp *interp in
22 Tcl interpreter from which file handle is to be obtained.
23 .AP "const char" *chanID in
24 String identifying channel, such as \fBstdin\fR or \fBfile4\fR.
25 .AP int write in
26 Non-zero means the file will be used for writing, zero means it will
27 be used for reading.
28 .AP int checkUsage in
29 If non-zero, then an error will be generated if the file was not opened
30 for the access indicated by \fIwrite\fR.
31 .AP ClientData *filePtr out
32 Points to word in which to store pointer to FILE structure for
33 the file given by \fIchanID\fR.
34 .BE
35
36 .SH DESCRIPTION
37 .PP
38 \fBTcl_GetOpenFile\fR takes as argument a file identifier of the form
39 returned by the \fBopen\fR command and
40 returns at \fI*filePtr\fR a pointer to the FILE structure for
41 the file.
42 The \fIwrite\fR argument indicates whether the FILE pointer will
43 be used for reading or writing.
44 In some cases, such as a channel that connects to a pipeline of
45 subprocesses, different FILE pointers will be returned for reading
46 and writing.
47 \fBTcl_GetOpenFile\fR normally returns \fBTCL_OK\fR.
48 If an error occurs in \fBTcl_GetOpenFile\fR (e.g. \fIchanID\fR did not
49 make any sense or \fIcheckUsage\fR was set and the file was not opened
50 for the access specified by \fIwrite\fR) then \fBTCL_ERROR\fR is returned
51 and the interpreter's result will contain an error message.
52 In the current implementation \fIcheckUsage\fR is ignored and consistency
53 checks are always performed.
54 .PP
55 Note that this interface is only supported on the Unix platform.
56
57 .SH KEYWORDS
58 channel, file handle, permissions, pipeline, read, write