File.Seek |
Top Previous Next |
Syntax function File.Seek(F: pointer; NewPos: large-integer; SeekOrigin: integer): integer
Alternative Names
Description Modifies the current position of the given file-stream.
The new position is based on the value for NewPos in combination with the SeekOrigin, which is one of the following constants:
The Return value is the actual new position of the file-stream.
See also
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; end
/* go back to the beginning */ File.Seek(fs, 0, __soFromBeginning);
/* read all available lines again */ while not File.EOF(fs) do begin /* get position before reading a line */ p = File.GetPosition(fs); valueout = File.ReadLn(fs); suspend; end finally File.Close(fs); end end |