<HTML><HEAD><TITLE>Tcl Library Procedures - Tcl_GetOpenFile manual page</TITLE></HEAD><BODY> <H3><A NAME="M2">NAME</A></H3> Tcl_GetOpenFile - Get a standard IO File * handle from a channel. (Unix only) <H3><A NAME="M3">SYNOPSIS</A></H3> <B>#include <tcl.h></B><BR> int<BR> <B>Tcl_GetOpenFile</B>(<I>interp, string, write, checkUsage, filePtr</I>)<BR> <H3><A NAME="M4">ARGUMENTS</A></H3> <DL> <P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD> Tcl interpreter from which file handle is to be obtained. <P><DT>char <B>*string</B> (in)<DD> String identifying channel, such as <B>stdin</B> or <B>file4</B>. <P><DT>int <B>write</B> (in)<DD> Non-zero means the file will be used for writing, zero means it will be used for reading. <P><DT>int <B>checkUsage</B> (in)<DD> If non-zero, then an error will be generated if the file wasn't opened for the access indicated by <I>write</I>. <P><DT>ClientData <B>*filePtr</B> (out)<DD> Points to word in which to store pointer to FILE structure for the file given by <I>string</I>. <P></DL> <H3><A NAME="M5">DESCRIPTION</A></H3> <B>Tcl_GetOpenFile</B> takes as argument a file identifier of the form returned by the <B><A HREF="../TclCmd/open.htm">open</A></B> command and returns at <I>*filePtr</I> a pointer to the FILE structure for the file. The <I>write</I> argument indicates whether the FILE pointer will be used for reading or writing. In some cases, such as a channel that connects to a pipeline of subprocesses, different FILE pointers will be returned for reading and writing. <B>Tcl_GetOpenFile</B> normally returns TCL_OK. If an error occurs in <B>Tcl_GetOpenFile</B> (e.g. <I>string</I> didn't make any sense or <I>checkUsage</I> was set and the file wasn't opened for the access specified by <I>write</I>) then TCL_ERROR is returned and <I>interp->result</I> will contain an error message. In the current implementation <I>checkUsage</I> is ignored and consistency checks are always performed. <P> Note that this interface is only supported on the Unix platform. <H3><A NAME="M6">KEYWORDS</A></H3> <A href="../Keywords/C.htm#channel">channel</A>, <A href="../Keywords/F.htm#file handle">file handle</A>, <A href="../Keywords/P.htm#permissions">permissions</A>, <A href="../Keywords/P.htm#pipeline">pipeline</A>, <A href="../Keywords/R.htm#read">read</A>, <A href="../Keywords/W.htm#write">write</A> <HR><PRE> <A HREF="../copyright.htm">Copyright</A> © 1996-1997 Sun Microsystems, Inc. <A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE> </BODY></HTML>