About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/stat_file.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 stat_file Context: slangrtl

Synopsis

Get information about a file

Syntax

Struct_Type stat_file (String_Type file)

Description

The stat_file function returns information about file through the use of the system stat call. If the stat call fails, the function returns NULL and sets errno accordingly. If it is successful, it returns a stat structure with the following integer fields:

    st_dev
    st_ino
    st_mode
    st_nlink
    st_uid
    st_gid
    st_rdev
    st_size
    st_atime
    st_mtime
    st_ctime

See the man page for stat for a discussion of these fields.

Example

The following example shows how the stat_file function may be used to get the size of a file:

     define file_size (file)
     {
        variable st;
        st = stat_file(file);
        if (st == NULL) verror ("Unable to stat %s", file);
        return st.st_size;
     }
Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.