Deleting a hirtogram from a file

Hello,
I would like to know how to remove a histogram from a file in a root session:

if I open the file, for example:

TFile *f = TFile::Open(“histograms_file.root”);

and I list the objects in the file with the command:

f->ls();

and I have in the file, for example, the histogram “h1”, is it correct to do:

f->Delete(“h1;1”);

??

Thank you very much,
Elena

You must open the file in “update” mode

Rene

Hi,

Yes it is correct but you need to open the file in update mode:TFile *f = TFile::Open("histograms_file.root","UPDATE");

Cheers,
Philippe.

Well, to open the file in update mode, you must do:

TFile *f = TFile::Open("histograms_file.root","update");
Rene