Declaración: procedure Truncate(var F);
var
f: file of Integer;
i,j: Integer;
begin
Assign(f,'PRUEBA.INT');
Rewrite(f);
for i := 1 to 6 do
Write(f,i);
Writeln('Antes de truncar:');
Reset(f);
while not Eof(f) do
begin
Read(f,i);
Writeln(i);
end;
Reset(f);
for i := 1 to 3 do
Read(f,j); { Leer 3 registros }
Truncate(f); { Y cortar aquí }
Writeln;
Writeln('Tras truncar:');
Reset(f);
while not Eof(f) do
begin
Read(f,i);
Writeln(i);
end;
Close(f);
Erase(f);
end.