Re: How to know if a file is finished writing or not ?

Wei Xie (xiewei@ceropa.weizmann.ac.il)
Mon, 6 Jul 1998 15:51:18 +0200 (EET)


Dear Rene,

The file in the example is a root file. How can I manage it
if it's a binary data file opened by:

FILE *fp = fopen("myfile.data","r");

Sincerely yours

Xie

> You can test if at least one object has been written to the file
> with:
>
> TFile *myfile;
> myfile = new TFile("myfile.root");
> if (myfile.GetSeekKeys() <= 64) {
> printf("file probably not yet closed\n");
> // wait and try again
> }
>
> Note that you will get a Warning message from Root every time
> you try to connect a file not yet closed.
>
> Rene Brun
>