Приклади Turbo Pascal 4.0
Страница: 1
Сообщений 1 страница 2 из 2
Поделиться22024-01-14 15:58:46
DEMOS1\CopyFil1\CopyFil1.pas:
Код:
{ Копіювання файлів } { 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 Assign(FromF, ParamStr(1)); { Open input file } Reset(FromF, 1); { Record size = 1 } Assign(ToF, ParamStr(2)); { Open output file } Rewrite(ToF, 1); { Record size = 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.
Страница: 1