Тип безтипових файлів, Детальна інформація
Тип безтипових файлів
program QuickCop;
const Bufsz=32768;
var f, g : file;
Buf : array[1..Bufsz] of char;
restfil, portion : Longint;
rdin, wrou : word; s : string;
begin
writeln( 'Задайте ім'я файла-джерела:');
readln (s); assign (f , s );
writeln( 'Задайте ім'я цільового файла:');
readln (s); assign (g , s );
reset(f, 1); rewrite(g, 1);
restfil:=filesize(f);
while restfil>0 do
begin
if restfil>Bufsz then portion:=Bufsz
else portion:=restfil;
dec(restfil, portion);
Blockread (f, Buf, portion, rdin);
if rdin<>portion then
begin
writeln('Помилка читання файла'); halt
end;
Blockwrite(g, Buf, portion, wrou);
if wrou<>portion then
begin
writeln('Помилка запису файла'); halt
end;
end;
close(g); close(f);
const Bufsz=32768;
var f, g : file;
Buf : array[1..Bufsz] of char;
restfil, portion : Longint;
rdin, wrou : word; s : string;
begin
writeln( 'Задайте ім'я файла-джерела:');
readln (s); assign (f , s );
writeln( 'Задайте ім'я цільового файла:');
readln (s); assign (g , s );
reset(f, 1); rewrite(g, 1);
restfil:=filesize(f);
while restfil>0 do
begin
if restfil>Bufsz then portion:=Bufsz
else portion:=restfil;
dec(restfil, portion);
Blockread (f, Buf, portion, rdin);
if rdin<>portion then
begin
writeln('Помилка читання файла'); halt
end;
Blockwrite(g, Buf, portion, wrou);
if wrou<>portion then
begin
writeln('Помилка запису файла'); halt
end;
end;
close(g); close(f);
The online video editor trusted by teams to make professional video in
minutes
© Referats, Inc · All rights reserved 2021