fgetstatus
- retrieves file status/properties

File Input/Output functions
(AmiBroker 4.90)


SYNTAX fgetstatus( filename, what, format = 0 )
RETURNS NUMBER or STRING
FUNCTION The function that retrieves file properties/status.

Returns NUMBER or STRING depending on format parameter. If file does not exist it returns Null.

Parameters:

  • filename - the name of the file (with or without full path) to query

  • what - specifies what file property to retrieve, allowable values
      0 - the date/time the file was created
    • 1 - the date/time the file was last modified
    • 2 - the date/time the file was last accessed for reading
    • 3 - the file size in bytes
    • 4 - attribute byte of the file

  • format - specifies return format of date/time values (format specifications are the same as in Now() function): allowed values:
    • 0 - returns string containing date/time formatted according to system settings
    • 1 - returns string containing date only formatted according to system settings
    • 2 - returns string containing time only formatted according to system settings
    • 3 - returns DATENUM number with date
    • 4 - returns TIMENUM number with time
    • 5 - returns DATETIME number with date/time
    • 6 - returns date DAY (1..31)
    • 7 - returns date MONTH (1..12)
    • 8 - returns date YEAR (four digit)
    • 9 - returns date DAY OF WEEK (1..7, where 1=Sunday, 2=Monday, and so on)
    • 10 - returns date DAY OF YEAR (1..366)

    Note that Windows supports only 2 second resolution of file date/time stamps.

EXAMPLE // get modification date string of portfolio.afl file
fgetstatus("formulas\\Equity\\portfolio.afl",1,0);
SEE ALSO fclose() function , fdelete() function , feof() function , fgets() function , fmkdir() function , fopen() function , fputs() function , frmdir() function

References:

The fgetstatus function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.