DADiSP Worksheet Functions > Function Categories > File Manipulation > FSTAT

 

FSTAT

Purpose:

Returns selected information about a file.

Syntax:

FSTAT("filename", infofield)

"filename"

-

A string. The name of the source file.

offset

-

Optional. An integer specifying the file information to return:

 

1

st _dev

disk drive on which the file resides

2

st_ino

inode number

3

st_mode

file mode

4

st_nlink

number of hard links

5

st_uid

user id

6

st_gid

group id

7

st_rdev

device type

8

st_size

total file size

9

st_atime

last accessed time

10

st_mtime

last modified time

11

st_ctime

last status change time

12

st_btime

last archived time

 

Returns:

An integer as specified by the infofield or -1 if the file does not exist.

Example:

fstat("myfile")

 

returns the size of myfile or -1 if it does not exist.

 

fstat("myfile", 10)

 

returns the last time (as an integer) myfile was modified or -1 if it does not exist.

Remarks:

FSTAT is a direct implementation of the stat function found in most versions of UNIX, Windows and DOS. See STRFTIME to convert the file time into a string.

See Also:

STRFTIME