Код:
{ Копіювання файлів } { Example for BlockRead and BlockWrite } program CopyFile; { Simple copy program w/NO error checking } var FromF, ToF: file; NumRead, NumWritten: Word; buf: array[1..2048] of Char; begin { Open input file } Assign(FromF, ParamStr(1)); { Record size = 1 } Reset(FromF, 1); { Open output file } Assign(ToF, ParamStr(2)); { Record size = 1 } Rewrite(ToF, 1); WriteLn('Copying ', FileSize(FromF), ' bytes...'); repeat BlockRead(FromF,buf, SizeOf(buf),NumRead); BlockWrite(ToF,buf,NumRead,NumWritten); until (NumRead = 0) or (NumWritten <> NumRead); Close(FromF); Close(ToF); end.