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_is.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 stat_is Context: slangrtl

Synopsis

Parse the st_mode field of a stat structure

Syntax

Char_Type stat_is (String_Type type, Integer_Type st_mode)

Description

The stat_is function returns a signed character value about the type of file specified by st_mode. Specifically, type must be one of the strings:

     "sock"     (socket)
     "fifo"     (fifo)
     "blk"      (block device)
     "chr"      (character device)
     "reg"      (regular file)
     "lnk"      (link)
     "dir"      (dir)

It returns a non-zero value if st_mode corresponds to type.

Example

The following example illustrates how to use the stat_is function to determine whether or not a file is a directory:

     define is_directory (file)
     {
        variable st;

        st = stat_file (file);
        if (st == NULL) return 0;
        return stat_is ("dir", st.st_mode);
     }
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.