How can I update the content of a root file?

Hi rooters
I have a root file, it contains five histograms, I would like to open the file by using the update option.

TFile *f=new TFile(“test.root”,“update”);
then I would like to scale one of those histograms
TH1D h=(TH1D)f->Get(“h”);
h->Scale(10);

I would like to update the histogram itself and not to create a new one beside the old one.

is there a way to do that?

Cheers

do:

TFile *f=new TFile("test.root","update"); TH1D *h=(TH1D*)f->Get("h"); h->Scale(10); h->Write("h",TObject::kOverwrite);
see doc of TObject::Write at root.cern.ch/root/html/TObject.h … ject:Write%1

Rene