: .
, . , . , , . . <Enter>, ( 10 13), ( 26). , . Turbo Delphi TextFile, ( ).
Turbo Delphi ( 7):
7
Eof (fv) | True, False |
EoLn (fv) | True, False |
SeekEof (fv) | True, - (, , ) False |
SeekEoLn (fv) | True, - (, , ) False |
FileExists(< + >) | True, False |
Append (fv) | |
AssignFile(fv,< + >) | ( ) |
CloseFile (fv) | ( ) |
Erase (fv) | |
Delete(< + >) | |
Read(fv,< >) | |
ReadLn(fv,< >) | |
Reset (fv) | |
Rewrite (fv) | |
Write(fv,< >) | |
WriteLn(fv, < >) | , , |
: , 7 fv .
|
|
. , , . Reset() , Rewrit() Append() . , Rewrite() , .
Read() :
- , , , ;
- (, );
- .
. , write (Fil, 10:5, 10.45678:8:2) , Fil, : 10 10.46.
, CloseFile(). ( ), Eof.
19. . , .
Flight.txt. Turbo Delphi tRec, Example _19 (.12).
.12. Flight.txt
Program Example_19;
{$APPTYPE CONSOLE}
Uses SysUtils;
Type
tRec = record //
city: string[10];
time: real48
num: word;
end;
Var
Name_File: string;
ch: char;
fv: textFile;
Procedure Find (Var f: textFile);
Var
city_Find: string[10];
time_Find: real48;
n: word;
r: tRec;
i: integer;
Begin
if not FileExists(Name_File) then
begin
writeln (' !');
Exit
end
else
begin
reset(f);
writeln (':');
write (': '); readln (city_Find);
write (' : '); readln (time_Find);
writeln (' :');
if Length (city_Find) < 10 then
for i:=1 to 10-Length (city_Find) do
city_Find:= Concat (city_Find,' ');
n:=0;
with r do
begin
while not Eof(f) do
while not Eoln (f) do
begin
read (f,city);
read (f,time);
readln (f,num);
if (city_Find = city) and (time_Find <= time) then
|
|
begin
n:=n+1;
writeln (n:3,' ',city:10,time:10:2,' ',num:5)
end;
end;
end;
end;
CloseFile(f);
if n = 0 then writeln (' !!!');
End; {Find}
Begin
write (' :');
readln (Name_File);
repeat
assignFile (fv,Name_File);
Find (fv);
write (' ?(y / n)');
readln (ch);
until UpCase(ch)='N';
writeln (' !');
readln
End.
(.13).
. 13. ( 19)
(F1), . . (F2) . , , c .
1. F2 F1, F1.
2. F2 F1, .
3. F2 F1, , F2.
4. F1 F2 , F1.
5. F1 F2 , - .
6. F1 F2 , .
7. F1 F2 , - .
8. F1 F2 , , , F2.
9. F1 F2 , F2.
10. F1 F2 , , F2.
11. F1 F2 , , , .
12. F1 F2 , , - .
13. F1 F2 , .
14. F1 F2 , , .
15. F1 F2 , - .
16. F1 F2 , .
17. F1 F2 , .
18. F1 F2 , .
19. F1 F2 , , , .
20. F1 F2 , , . .
21. F1 F2 , , . .
22. F1 F2 , . .
23. F1 F2 , , . .
|
|
24. F1 F2 , . .
25. F1 F2 , , . .