home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / bix / fcopy.pas < prev    next >
Pascal/Delphi Source File  |  1986-08-04  |  894b  |  28 lines

  1. {If you find the need from within a Turbo program to copy a file from
  2. one disk to another, here's a Procedure you can use.  All it needs are
  3. the names of the files (Source & Dest) as input; you should also
  4. declare the Type STR20 as String[20] somewhere in your program.}
  5.  
  6.  
  7.  
  8.          Procedure CopyFile (Source, Dest : Str20);
  9.          Const  Recsize = 128;
  10.                 Bufsize =  96;
  11.  
  12.          Var  Fin, Fout : File;
  13.               RecsRead  : Integer;
  14.               Buffer    : Array [1..Bufsize, 1..Recsize] of Byte;
  15.  
  16.          Begin
  17.            Assign (Fin,  Source);   Assign (Fout, Dest);
  18.            Reset  (Fin);            Rewrite(Fout);
  19.  
  20.            Repeat
  21.               BlockRead  (Fin,  Buffer, Bufsize, RecsRead);
  22.               BlockWrite (Fout, Buffer, RecsRead);
  23.               Until RecsRead = 0;
  24.  
  25.            Close (Fin);  Close (Fout);
  26.  
  27.            End;
  28.