Go to main content

man pages section 3: Extended Library Functions, Volume 1

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Tcl_GetOpenFile (3tcl)

Name

Tcl_GetOpenFile - Return a FILE* for a channel registered in the given interpreter (Unix only)

Synopsis

#include <tcl.h>

int
Tcl_GetOpenFile(interp, chanID, write, checkUsage, filePtr)

Description

Tcl_GetOpenFile(3tcl)       Tcl Library Procedures       Tcl_GetOpenFile(3tcl)



______________________________________________________________________________

NAME
       Tcl_GetOpenFile  - Return a FILE* for a channel registered in the given
       interpreter (Unix only)

SYNOPSIS
       #include <tcl.h>

       int
       Tcl_GetOpenFile(interp, chanID, write, checkUsage, filePtr)


ARGUMENTS
       Tcl_Interp *interp (in)             Tcl  interpreter  from  which  file
                                           handle is to be obtained.

       const char *chanID (in)             String identifying channel, such as
                                           stdin or file4.

       int write (in)                      Non-zero means  the  file  will  be
                                           used  for  writing,  zero  means it
                                           will be used for reading.

       int checkUsage (in)                 If non-zero, then an error will  be
                                           generated   if  the  file  was  not
                                           opened for the access indicated  by
                                           write.

       ClientData *filePtr (out)           Points  to  word  in which to store
                                           pointer to FILE structure  for  the
                                           file given by chanID.
______________________________________________________________________________


DESCRIPTION
       Tcl_GetOpenFile  takes  as  argument  a  file  identifier  of  the form
       returned by the open command and returns at *filePtr a pointer  to  the
       FILE  structure for the file.  The write 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.   Tcl_GetOpen-
       File  normally  returns  TCL_OK.  If an error occurs in Tcl_GetOpenFile
       (e.g. chanID did not make any sense or checkUsage was set and the  file
       was  not  opened  for  the access specified by write) then TCL_ERROR is
       returned and the interpreter's result will contain  an  error  message.
       In  the  current  implementation  checkUsage is ignored and consistency
       checks are always performed.

       Note that this interface is only supported on the Unix platform.


KEYWORDS
       channel, file handle, permissions, pipeline, read, write



ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | runtime/tcl-8    |
       +---------------+------------------+
       |Stability      | Uncommitted      |
       +---------------+------------------+

NOTES
       Source code for open source software components in Oracle  Solaris  can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This    software    was    built    from    source     available     at
       https://github.com/oracle/solaris-userland.    The  original  community
       source was downloaded from  http://prdownloads.sourceforge.net/tcl/tcl-
       core8.6.7-src.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.tcl.tk/.



Tcl                                   8.0                Tcl_GetOpenFile(3tcl)