[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
SEEK Move the File Position Pointer pp 95
Syntax: Seek (FileVar,NumVar) ;
Type: File
Form: Procedure
Purpose: Move the file position pointer Bytes from the current position.
NumVar can be -32767 to 32767.
Notes: Use LongFilePos, LongFileSize, and LongSeek with MS-DOS.
Seek does not apply to text files.
----------------------------------------------------------------------------
Usage:
TYPE
FileType = Record { Define record size }
Name : String [4] ; { Length is $04 bytes }
Age : Byte ;
Month : Byte ;
Day : Byte ;
Year : Integer ;
End ; { End of record }
VAR
FileVar : File of FileType ; { 80 byte record type }
FileRec : FileType ; { Record matches file type }
BEGIN
Assign (FileVar,'D:Test.Dat') ; { Assign name to handle }
ReWrite (FileVar) ; { Open and clear file }
Seek (FileVar,0 ) ; { Move pointer to BOF }
FileRec.Name := 'Name' ; { File = $04,'Name' }
FileRec.Age := 69 ; { File = $45 }
FileRec.Month := 11 ; { File = $0B }
FileRec.Day := 4 ; { File = $04 }
FileRec.Year := 1950 ; { File = $079E }
Write (FileVar,FileRec) ; { Write record to file }
Seek (FileVar, FileSize(FileVar)); { Seek to end of file }
Close (FileVar) ; { Close file handle }
END.
See Also:
FilePos
FileSize
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson