FSizeGet Function

Action

Returns the size of a specified file.

Include file

Kernel.bdh

Syntax

FSizeGet( in  hFile : number,
          out nSize : 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.
nSize Variable receiving the file size

Example

dcltrans
  transaction TMain
  var
    hFile, nSize : number;
    sOutput      : string;
  begin
    // create a file and store a string
    FOpen(hFile, "c:\\temp\\dummyfile.txt", OPT_FILE_ACCESS_READWRITE, OPT_FILE_CREATE);
    sOutput := "Hello world!";
    FWrite(hFile, sOutput);
    write("new file created"); writeln;

    // display current file size
    FSizeGet(hFile, nSize);
    write("file size = "); write(nSize); writeln;

    // close file
    FClose(hFile);
    write("file closed"); writeln;
  end TMain;

Output

new file created
file size = 12
file closed

Sample scripts

WebFileUpload01.bdf