.


:




:

































 

 

 

 





:

var F:file of _,
_ , . .. .

:

type Matrix=array[1..10,1..15] of real;

Person=record

FIO:string[20];

group:1..12

end;

var FI: file of integer; //

FM: file of Matrix; //

FP: file of Person; //

C :

... Eof

: , , . 0.

1) - , .. , , , -.

2) , . Reset Rewrite , , 0- .

function FilePos (F): int64

.

- FilePos(F)=0

- FilePos(F)=FileSize(F)

function FileSize (F): int64

.

procedure Seek (F, n)

n.

- : Seek(F,0)

- : Seek(F,FileSize(F)-1)

procedure Truncate (F)

, .

: Seek(F,0); Truncate(F) : Rewrite(F).

:

var F:File of integer; x:integer;

1

Reset(F);

while not Eof(F) do Read(F,x); //

// FilePos(F)-1

2

Reset(F);

for i:=0 to Filesize(F)-1 do Read(F,x) //

// i.

 

( )

Reset(F);

for i:=Filesize(F)-1 downto 0 do // i 0-

begin Seek(F,i); Read(F,x) end

 

Reset(F);

while not Eof(F) do

begin Read(F,x);

if (x xnew) then

begin Seek(FilePos(F)-1); // , x

write(F,xnew) //

end

end

 

1. , , /

for i:=p+1 to Filesize(F)-1 do //p

begin

Seek(F,i);

read(F,x);

Seek(F,i-1);

write(F,x);

end;

Truncate(F); //

 

2. , .

Rewrite(Fnew); //

Seek(F,p); //p

while not Eof(F) do

begin

read(F,x);

if (FilePos(F)-1)<>p

then write(Fnew,x);

end;

 

3. , . . .

Seek(F,Filesize(F)-1); //

Read(F,y); //

Seek(F,p); //p

write(F,y);

Seek(F,Filesize(F)-1);

Truncate(F); //





:


: 2016-11-12; !; : 1154 |


:

:

80% - .
==> ...

1533 - | 1384 -


© 2015-2024 lektsii.org - -

: 0.009 .