program copy;

{...............1979624,11749046}

var b:byte;
    f1,f2,f3:file;
    a:integer;
    n:word;
  Buf: array[1..2048] of Char;
  NumRead, NumWritten: Word;

begin
     assign (f1,'file1.mp3');
     reset (f1,1);
     assign (f2,'file2.mp3');
     rewrite (f2,1);
     assign (f3,'file3.mp3');
     rewrite (f3,1);

     a:=0;

  repeat
    a:=a+1;
    BlockRead(f1, Buf, SizeOf(Buf), NumRead);
    if a<967 then BlockWrite(f2, Buf, NumRead, NumWritten)
             else BlockWrite(f3, Buf, NumRead, NumWritten);
  until (NumRead = 0) or (NumWritten <> NumRead);


{    for a:=0 to 1979624 do
         begin
              blockRead(f1, b, 1979624, n);
              Blockwrite(f2, b, 1979624, n);
{           read (f1,b);
           write (f2,b);
         end;           }
{     for a:=1979625 to 11749046 do
         begin
              BlockRead(f1, b, a, n);
              Blockwrite(f3, b, a, n);

           read (f1,b);
           write (f3,b);
         end;}
     close (f1);
     close (f2);
     close (f3);
end.

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.




