Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> longseek move the file position pointer pp 199</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 LONGSEEK               Move the File Position Pointer                pp 199

 Syntax:  LongSeek (FilVar,RealVar) ;

 Type:    File

 Form:    Procedure

 Purpose: Move position pointer RealVar bytes from the current position.

 Notes:   MS-DOS long function for larger files.
          RealVar is type Real.


 ----------------------------------------------------------------------------


 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      }
          LongSeek(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     }
          LongSeek(FileVar, FileSize(FileVar));  { Seek to end of file      }
          Close   (FileVar)                   ;  { Close file handle        }
       END.

See Also: LongFilePos LongFileSize

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson