MAN page from OpenSuSE 12.X aolserver-tcl-devel-8.5.13-2.1.i586.rpm
Section: Tcl Library Procedures (3)
Tcl_Access, Tcl_Stat - check file permissions and other attributes
#include <tcl.h>intTcl_Access(path, mode)intTcl_Stat(path, statPtr)
- char *path (in)Native name of the file to check the attributes of.
- int mode (in)Mask consisting of one or more of R_OK, W_OK, X_OK and F_OK. R_OK,W_OK and X_OK request checking whether the file exists and has read,write and execute permissions, respectively. F_OK just requestschecking for the existence of the file.
- struct stat *statPtr (out)The structure that contains the result.
As of Tcl 8.4, the object-based APIs Tcl_FSAccess andTcl_FSStat should be used in preference to Tcl_Access andTcl_Stat, wherever possible.
There are two reasons for calling Tcl_Access and Tcl_Statrather than calling system level functions access and statdirectly. First, the Windows implementation of both functions fixessome bugs in the system level calls. Second, both Tcl_Accessand Tcl_Stat (as well as Tcl_OpenFileChannelProc) hookinto a linked list of functions. This allows the possibility to reroutefile access to alternative media or access methods.
Tcl_Access checks whether the process would be allowed to read,write or test for existence of the file (or other file system object)whose name is pathname. If pathname is a symbolic link on Unix,then permissions of the file referred by this symbolic link aretested.
On success (all requested permissions granted), zero is returned. Onerror (at least one bit in mode asked for a permission that is denied,or some other error occurred), -1 is returned.
Tcl_Stat fills the stat structure statPtr with informationabout the specified file. You do not need any access rights to thefile to get this information but you need search rights to alldirectories named in the path leading to the file. The stat structureincludes info regarding device, inode (always 0 on Windows),privilege mode, nlink (always 1 on Windows), user id (always 0 onWindows), group id (always 0 on Windows), rdev (same as device onWindows), size, last access time, last modification time, and creationtime.
If path exists, Tcl_Stat returns 0 and the stat structureis filled with data. Otherwise, -1 is returned, and no stat info isgiven.
This document was created byman2html,using the manual pages.