FIsOpen Function

Action

Checks whether a specified file is currently open.

If the file name includes a directory name, the file is opened in the specified directory. Otherwise, Silk Performer searches for the file in the directory where the test script is located, in the data directory, in the results directory, and in the project directory.

Include file

Kernel.bdh

Syntax

FIsOpen( in sFileName: string ): boolean;

Return value

  • true if the specified file is currently open

  • false otherwise

Parameter Description
sFileName Name of the file

Example

const
  scFileName := "c:\\temp\\dummyfile.txt";

dclfunc
  function DisplayFileStatus
  begin
    if FIsOpen(scFileName) then
      write("file is currently open"); writeln;
    else
      write("file is currently closed"); writeln;
    end;
  end DisplayFileStatus; 

dcltrans
  transaction TMain
  var
    hFile: number;
  begin
    // check whether file is currently open
    DisplayFileStatus();
    // open file
    FOpen(hFile, scFileName, OPT_FILE_ACCESS_READWRITE, OPT_FILE_CREATE);
    write("file opened"); writeln;
    // check whether file is currently open
    DisplayFileStatus();
    // close file
    FClose(hFile);
    write("file closed"); writeln;
    // check whether file is currently open
    DisplayFileStatus();
  end TMain;

Output

file is currently closed
file opened
file is currently open
file closed
file is currently closed