FCurrentPositionGet Function

Action

Returns the current position of the file pointer.

Include file

Kernel.bdh

Syntax

FCurrentPositionGet( in  hFile : number,
                     out nPos  : 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.
nPos Variable receiving the current position of the file pointer

Example

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

    // get current file position
    FCurrentPositionGet(hFile, nPos);
    write("current pos = "); write(nPos); writeln;
 
    // close file
    FClose(hFile);
    write("file closed"); writeln;
  end TMain;

Output

new file created
current pos = 12
file closed