home *** CD-ROM | disk | FTP | other *** search
- Program BurnIn;
-
- Type
- String10 = String [10];
- BurnType = Record
- ID : String10;
- MyVal : Real;
- End;
-
- Const
- MyBurnIn : BurnType = ( ID:'MyUniqueID'; MyVal:3.1415926 );
-
- Var
- c : LongInt;
- f : File;
- s : String10;
-
- Begin
-
- WriteLn ( 'ID is currently = ',MyBurnIn.ID );
- WriteLn ( 'MyVal is currently = ',MyBurnIn.MyVal );
- MyBurnIn.MyVal := MyBurnIn.MyVal + 1;
- WriteLn ( 'Next time, MyVal = ',MyBurnIn.MyVal );
-
- Assign ( f, ParamStr ( 0 ) ); { Set file variable = to program that is }
- Reset ( f, 1 ); { currently running. Set buffer size = 1 }
- c := FileSize ( f ); { Get current size of the file }
- c := c - SizeOf ( s ); { Set size to size - string length }
- s := ''; { Initialize the search string }
- While ( c > 0 ) and ( s <> MyBurnIn.ID ) Do
- Begin { Loop until we reach the start of the file, or a match is }
- { found. }
- Seek ( f, c ); { Move file pointer to new location }
- BlockRead ( f, s, SizeOf ( s ) ); { Block read into the search string }
- Dec ( c ); { Decrement the counter by 1 position }
- End;
- If ( c > 0 ) Then { If we did find the string, do the following }
- Begin
- Seek ( f, c + 1 ); { Seek to the offset of the found string }
- BlockWrite ( f, MyBurnIn, SizeOf ( MyBurnIn ) ); { Write the new record }
- End;
- Close ( f ); { Close the file }
- End.
-