March 2000
Intermediate to advanced
576 pages
18h 13m
English
Seek Procedure
procedure Seek(var F: File; RecordNumber: LongInt);
The Seek procedure moves the file position to
RecordNumber. Seek is
not a real
function.
You cannot call Seek for a
TextFile. If you must seek to a specific position,
use the Windows API:
// Seek to a byte position in a text file. See SetInOutRes for the // same procedure with error-handling. Assume the buffer is empty. procedure TextSeek(var F: TextFile; Pos: LongInt); begin SetFilePointer(TTextRec(F).Handle, Pos, nil, File_Begin); end;
The start of the file is record number 0.
If F is an untyped File, the
record size is set when you open the file with
Reset or Rewrite.
// Rewind a file to the beginning. Seek(F, 0); // Jump to the end of a file. Seek(F, FileSize(F));
| File Keyword, FilePos Function, IOResult Function |
Read now
Unlock full access