FSTAT

Concept Link IconSee also

Return the size and last modification date for the specified file.

WebVue support - Yes.

Syntax

IntVal = FSTAT(Filename, Handle);

Return type: INTEGER.

Argument

Meaning

Filename

The name of the file. Type STR.
If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the referenced file is on that computer.

Handle

The location of the memory buffer in which the data is to be returned. Type LONG.

Execution

The file statistics are returned in a memory buffer previously allocated with ALLOC_BUFFER or by FILETOBUF. The size of the file is found at an offset of 0 and the date at an offset of 4. The minimum buffer size for the operation is 22. The file may be open or closed.

Return: 1 if successful, else 0.

Example

DIM bufh as LONG; 'buffer handle
CONST SIZE=0; 'offset to read the size
CONST MODIF=4; 'offset to read the date
CONST ALLOC=22; '22 is the minimum required
bufh=ALLOC_BUFFER(ALLOC);
IF(FSTAT("file.txt",bufh)==1) THEN
  PRINT("Size in bytes:",LGET_BUFFER(bufh,SIZE));
  PRINT("Date of last modification:",CGET_BUFFER (bufh,MODIF,18));
END IF

FREE_BUFFER(bufh); 'free buffer