Advertisement
believe_me

Untitled

May 18th, 2022
2,019
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. procedure readSubscribers(var RequiredSubscriber: TRequiredSubscriber);
  2. var
  3.     SourceFile: TBinaryFile;
  4.     TelephoneNumberArray: TTelephoneNumber;
  5.     SurnameArray: TSurname;
  6.     NameArray: TName;
  7.     PatromynicArray: TPatronymic;
  8.     CityArray: TCity;
  9.     DateofPayArray: TDateOfPay;
  10.     Number: TNumber;
  11.     CurrentOffset, Offset: integer;
  12.     OneByte: ansichar;
  13.     NumberOfDays: longWord;
  14. begin
  15.     assign(SourceFile, getCurrentDir + '\' + FILE_NAME);
  16.     reset(SourceFile);
  17.     Offset := START_SUBSCRIBER_OFFSET;
  18.     Seek(SourceFile, Offset);
  19.     while not EOF(SourceFile) do
  20.     begin
  21.         blockRead(SourceFile, OneByte, 1);
  22.         if OneByte <> DELETER then
  23.         begin
  24.             Seek(SourceFile, Offset);
  25.             blockRead(SourceFile, Number, NUMBER_LENGTH);
  26.             if isRequiredSubscriber(SourceFile, TelephoneNumberArray,
  27.               SurnameArray, NameArray, PatromynicArray, CityArray,
  28.               RequiredSubscriber) then
  29.             begin
  30.                 blockRead(SourceFile, DateOfPayArray, DATE_OF_PAY_LENGTH);
  31.                 NumberOfDays := dateToNumber(DateOfPayArray);
  32.                 SubscriberList.add(TelephoneNumberArray, SurnameArray,
  33.                   NameArray, PatromynicArray, CityArray, NumberOfDays, Number);
  34.             end;
  35.         end;
  36.         Offset := Offset + RECORD_SIZE;
  37.         Seek(SourceFile, Offset);
  38.     end;
  39.     close(SourceFile);
  40. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement