Moves the current position of a file to a specified component. UnitSystemCategoryI/O routinesprocedure Seek(var F; N: Longint);DescriptionUse Seek to move to a specified position in open typed or untyped files. The current file position of F moves to component number N. The number of the first component of a file is 0.In the above syntax, F is a typed or untyped file variable. The file specified by F must be open. N is an expression of type LongintTo expand a file, seek one component beyond the last component; that is, the statement Seek(F, FileSize(F)) moves the current file position to the end of the file.Note: {$I+} handles run-time errors using exceptions. When using {$I-}, use IOResult to check for I/O errors.
再用EOF构成循环,一个一个判断Tests whether the file position is at the end of a file.UnitSystemCategoryI/O routinesTyped or untyped files:function Eof(var F): Boolean;Text files:function Eof [ (var F: Text) ]: Boolean;DescriptionEof tests whether the current file position is the end-of-file. F is a file variable. If F is omitted, the standard file variable Input is assumed. Eof(F) returns True if the current file position is beyond the last character of the file or if the file is empty; otherwise, Eof(F) returns False.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货