: : i know that to create a backup, i could make a new file identical to the onw i want to copy and then actually gather the data from the file and copy it all into the new one and therefore creating a backup but is there any easier way?
: :
: : Doing it the way i have explained is a lot of code and is very confusing. I mean, in windows, you could simply copy and paste the file and i was thinking along those lines.
: :
: : HELP
: :
: :
: :
: You could use the CopyFile() API function. Or you could open 2 TFileStream objects and call the CopyFrom() method. Here is the code for the stream variant:
:
: Source := TFileStream.Create(SourceFileName, fmOpenRead);
: Dest := TFileStream.Create(DestFileName, fmCreate);
: Dest.CopyFrom(Source, Source.Size);
: Dest.Free;
: Source.Free;
:
:
How does the copyfile() API function work