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