Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program rekordowy.seriale;
- {$mode objfpc}{$H+}
- uses
- {$IFDEF UNIX}{$IFDEF UseCThreads}
- cthreads,
- {$ENDIF}{$ENDIF}
- Classes
- { you can add units after this };
- type rekordowy=record
- nazwa:string[100];
- rokProdukcji:integer;
- end;
- plikowy = File of rekordowy ;
- var plik1:plikowy ;
- procedure ZapisR (var plik:plikowy ; nazwa:string);
- var serial:rekordowy ; n:byte; i:byte;
- begin
- ASSIGNFILE(plik,nazwa);
- {$I-}RESET(plik);{$I+}
- if IOResult<>0 then REWRITE(plik)
- ELSE seek (plik,filesize(plik));
- write('Podaj liczbe wpisywanych seriali: ');
- readln(n);
- for i:=1 to n do
- begin
- write('Podaj nazwe serialu: ');
- readln(serial.nazwa);
- write('Podaj rok produkcji serialu: ');
- readln(serial.rokProdukcji);
- write(plik,serial);
- end;
- closefile(plik);
- end;
- procedure OdczytR (var plik:plikowy ; nazwa:string);
- var serial:rekordowy ;
- begin
- ASSIGNFILE(plik,nazwa);
- {$i-} RESET(plik); {$i+}
- if IOResult=0 then
- begin
- writeln('Odczytuje plik ',nazwa,' : ');
- while not EOF(plik) do
- begin
- read(plik,serial);
- writeln('Serial ',serial.nazwa,' powstal w roku ',serial.rokProdukcji);
- end;
- closefile(plik);
- end
- ELSE
- writeln('brak pliku ',nazwa);
- end;
- begin
- ZapisR(plik1,'Seriale.txt');
- OdczytR(plik1,'Seriale.txt');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement