home *** CD-ROM | disk | FTP | other *** search
- Program Pseudo;
-
- Uses
- FileLock;
-
- Type
- RecType = ...
- FileType = File of RecType;
-
- Var
- r : RecType;
- f : FileType;
- rn : LongInt;
- oldExit : Pointer
-
- {$F+}
- Procedure MyExit;
- {$F-}
- Begin
- ExitProc := oldExit;
- Seek ( f, 0 );
- While not EOF ( f ) Do
- Begin
- if Unlock ( f, FilePos ( f ) ) Then ;
- Read ( f, r );
- End;
- Close ( f );
- End;
-
- Begin
- oldExit := ExitProc;
- ExitProc := @MyExit;
-
- Assign ( f, 'filename' );
- FileMode := 66;
- Reset ( f );
- Repeat
- rn := GetRecordNumber;
- Repeat Until Lock ( f, rn );
- Seek ( f, rn-1 );
- Read ( f, r );
- EditRecord ( r );
- Write ( f, r );
- Repeat Until UnLock ( f, rn );
- Until Done;
- Close ( f );
- End.
-