File.SetPosition

Top  Previous  Next

 

Syntax

function File.SetPosition(F: pointer; NewPosition: large-integer): boolean

 

Description

Sets the current position of the given file-stream to the value of NewPosition.

 

This routine always Returns TRUE.

 

See also

File.GetPosition
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