[fpc-pascal] Problems with moving/renaming file using sysutils.renamefile

Sven Barth pascaldragon at googlemail.com
Fri Feb 10 14:04:20 CET 2012


Am 10.02.2012 13:31, schrieb Reinier Olislagers:
> 2. What is the function for "properly" moving files in FPC that also
> moves between partitions, if one exists?

What I'd use in those cases:

var
   dest, source: TFileStream;
begin
   dest := Nil;
   source := TFileStream.Create(aSourceFileName, fmOpenRead);
   try
     dest := TFileStream.Create(aDestFileName, fmCreate or fmOpenWrite);
     dest.CopyFrom(source, source.Size);
   finally
     dest.Free;
     source.Free;
   end;
end;

Regards,
Sven



More information about the fpc-pascal mailing list