File.GetPosition

Top  Previous  Next

 

Syntax

function File.GetPosition(F: pointer): large-integer

 

Alternative Names

ibec_fs_Position

 

Description

Returns the current position for the given file-stream. The position is always => 0 and < size.

 

See also

File.SetPosition
File.Seek

 

Example

execute udsblock returns (valueout varchar(1024))

as

begin

  /* open text file with UTF8 encoding preamble */ 

  fs = File.Open('c:\data\utf8text.txt', __fmOpenReadWrite + __fmShareDenyWrite);

  try

    /* read all available lines */

    while not File.EOF(fs)

    do begin

     /* get position before reading a line */

     p = File.GetPosition(fs);

         valueout = File.ReadLn(fs);

     suspend;

     /* set position to before reading the line */

         File.SetPosition(fs, p);

     /* read the line again */

         valueout = File.ReadLn(fs);

         suspend; 

       end

  finally

    File.Close(fs);

  end

end