FClose Function

Action

Closes a file.

Include file

Kernel.bdh

Syntax

FClose( inout hFile: number ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hFile Valid handle to an open file. This handle must have been returned from a previous call to FOpen.

Example

dcltrans
  transaction TMain
  var
    hFile : number;
    sOutput : string;
  begin
    // create new file
    FOpen(hFile, "c:\\temp\\dummyfile.txt", OPT_FILE_ACCESS_READWRITE, OPT_FILE_CREATE);
    write("new file created"); writeln;

    // write string to file
    sOutput := "Hello world!";
    FWrite(hFile, sOutput);
    write("string written to file"); writeln;
 
    // close file
    FClose(hFile);
    write("file closed"); writeln;
  end TMain;

Output

new file created
string written to file
file closed

Sample scripts

WebFileUpload01.bdf