Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure readSubscribers(var RequiredSubscriber: TRequiredSubscriber);
- var
- SourceFile: TBinaryFile;
- TelephoneNumberArray: TTelephoneNumber;
- SurnameArray: TSurname;
- NameArray: TName;
- PatromynicArray: TPatronymic;
- CityArray: TCity;
- DateofPayArray: TDateOfPay;
- Number: TNumber;
- CurrentOffset, Offset: integer;
- OneByte: ansichar;
- NumberOfDays: longWord;
- begin
- assign(SourceFile, getCurrentDir + '\' + FILE_NAME);
- reset(SourceFile);
- Offset := START_SUBSCRIBER_OFFSET;
- Seek(SourceFile, Offset);
- while not EOF(SourceFile) do
- begin
- blockRead(SourceFile, OneByte, 1);
- if OneByte <> DELETER then
- begin
- Seek(SourceFile, Offset);
- blockRead(SourceFile, Number, NUMBER_LENGTH);
- if isRequiredSubscriber(SourceFile, TelephoneNumberArray,
- SurnameArray, NameArray, PatromynicArray, CityArray,
- RequiredSubscriber) then
- begin
- blockRead(SourceFile, DateOfPayArray, DATE_OF_PAY_LENGTH);
- NumberOfDays := dateToNumber(DateOfPayArray);
- SubscriberList.add(TelephoneNumberArray, SurnameArray,
- NameArray, PatromynicArray, CityArray, NumberOfDays, Number);
- end;
- end;
- Offset := Offset + RECORD_SIZE;
- Seek(SourceFile, Offset);
- end;
- close(SourceFile);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement