Tcl_EnterFile(interp, file, permissions)
int
Tcl_GetOpenFile(interp, string, write, checkUsage, filePtr)
int
Tcl_FilePermissions(file)
Tcl_GetOpenFile takes as argument a file identifier of the form returned by the open command or Tcl_EnterFile 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 file that connects to a pipeline of subprocesses, different FILE pointers will be returned for reading and writing. Tcl_GetOpenFile normally returns TCL_OK. If an error occurs in Tcl_GetOpenFile (e.g. string didn't make any sense or checkUsage was set and the file wasn't opened for the access specified by write) then TCL_ERROR is returned and interp->result will contain an error message. If checkUsage is zero and the file wasn't opened for the access specified by write, then the FILE pointer returned at *filePtr may not correspond to write.
Tcl_FilePermissions returns an OR-ed combination of the mask bits TCL_FILE_READABLE and TCL_FILE_WRITABLE; these indicate whether the given file was opened for reading or writing or both. If file does not refer to a file in Tcl's file table then -1 is returned.
Copyright © 1989-1993 The Regents of the University of California. Copyright © 1994 Sun Microsystems, Inc. Copyright © 1995 Roger E. Critchlow Jr.