On 02 Sep 22  21:22:49, Chad Adams said the following to All:
Does anyone know a function that will allow you to copy one file to another location?
CopyFile(File, File2);
procedure SAFECOPY (fromFile, toFile : string);
  type bufferType = array [1..64] of char;
  type bufferTypePtr = ^bufferType;  { Use the heap }
  var bufferPtr : bufferTypePtr;     { for the buffer }
      f1, f2 : file;
      bufferSize, readCount, writeCount : word;
      fmSave : byte;              { To store the filemode }
  begin
    bufferSize := SizeOf(bufferType);
    New (bufferPtr);              { Create the buffer, on the heap }
    fmSave := FileMode;           { Store the filemode }
    FileMode := 0;                { To read also read-only files }
    Assign (f1, fromFile);
    {$I-} Reset (f1, 1);          { Note the record size 1, important! }
    if IOResult <> 0 then exit;   { Does the file exist? }
    Assign (f2, toFile);
    {$I-} Rewrite (f2, 1);        { Open the target }
    if IOResult <> 0 then exit;
    repeat                        { Do the copying }
      BlockRead (f1, bufferPtr^, bufferSize, readCount);
      {$I-} BlockWrite (f2, bufferPtr^, readCount, writeCount);      
      if IOResult <> 0 then begin close (f1); exit; end;
    until (readCount = 0) or (writeCount <> readCount);
    close (f1); close (f2);
    FileMode := fmSave;           { Restore the original filemode }
    Dispose (bufferPtr);          { Release the buffer from the heap }
  end;  (* safecopy *)
Nick
--- Renegade vY2Ka2
 * Origin: Joey, do you like movies about gladiators? (1:229/426)