stat()                   Get File-Status Information on Named File
 
 #include   <sys\types.h>
 #include   <sys\stat.h>
 
 int          stat(pathname,buffer);
 char         *pathname;                 Path name of existing file
 struct stat  *buffer;                   Pointer to struct receiving results
 
    stat() gets and stores information about the file or directory
    specified by 'pathname'.  The information is stored in the structure
    pointed to by 'buffer'.  The 'stat' structure (defined in
    <sys\stat.h>) has the following fields:
 
            st_mode     Bit mask giving information about the
                        open file's mode.  S_IFDIR bit is set if 'pathname'
                        refers to a directory.  S_IFREG is set if 'pathname'
                        refers to an ordinary file.  Read/write permission
                        bits set according to the file's permission mode;
                        execute bits set using the file-name extension.
 
            st_dev      Drive number of the disk containing the file.
 
            st_rdev     Same as 'st_dev'.
 
            st_nlink    Always set to the constant 1.
 
            st_size     Size of the file in bytes.
 
            st_atime    Time of the most recent modification of the file.
            st_mtime    Same as 'st_atime'.
            st_ctime    Same as 'st_atime' and 'st_mtime'.
 
    Returns:    Zero if the file-status information has been successfully
                retrieved. A value of -1 indicates a failure to get the
                information.  On errer, 'errno' is set to ENOENT,
                indicating the file name or path name could not be found.
 
      Notes:    If 'pathname' refers to a device, the size and time
                fields of the 'stat' structure are not meaningful.
 
                The 'stat' structure contains three additional fields
                that hold values that are not meaningful under MS-DOS.

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster