Backup from an open file

How can i made a backup from an open file???

* with a different program

         !!!Thanks for your time!!!

e-mail: scortega@javercol.javeriana.edu.co
kort77Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
interConnect With a Mentor Commented:
Hi,

The opened fields can be opened for reading using a Mode called COMPATIBILITY mode the following program part shows you how to open and read from such a file:

procedure WriteFileToBackUp(FileName:string;BackSt : TFileStream);
var
  Buffer : array[0.16384] of char;
  Size  : integer;
  St : TFileStream;
begin
  St := TFileStream.Create(FileName,fmOpenRead + fmShareCompat);
  try
    while not St.Eof do
    begin
       Size := St.Read(Buffer, SizeOf(Buffer));
       // Here do what ever you want with buffer
       // But be sure to use only Size bytes of the buffer
       // for example if you have another backupstream
       // BackSt.Write(Buffer, Size);
    end;
  finally
    St.Free;
  end;
end;

Regards,
Igor
0
 
paulo_psaCommented:
Hi kort77,

If you used LoadFromFile(filename) to open the file, you can use LoadToFile(filename) to save the file.


Regards...
0
 
gysbert1Commented:
Do you want to back up with a different program or with your own ?

You cannot open files that are open already other than readonly. You can thus copy the open file to a backup directory even if it is open and then do the backup. Most backup packages open the file hard (not read only) and thus gives a "Error opening file" when trying to backup an open file ...

If you have copied everything you can safely back everything up ...
0
 
kort77Author Commented:
Edited text of question
0
 
mriderCommented:
has file been opened with your program?

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.