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.
Kernel.bdh
FIsOpen( in sFileName: string ): boolean;
true if the specified file is currently open
false otherwise
Parameter | Description |
---|---|
sFileName | Name of the file |
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;
file is currently closed file opened file is currently open file closed file is currently closed