Writing an header in a TFile

Dear all,
I hope this is going to be a simple one.

I would like to save a string, in whatever format is feasible (std::string, const char*, TString), in a TFile. It should contain the name of the config file I used to run my job whose results I save in that root file.

E.g.

TFile *f = new TFile("data.root");
f->cd();

// The header I want to save
TString headerFile("../configs/Config-default.xml");

f->Write();

// all other usual stuff: TTree, etc..

f->Close();

It is not working for me…

Any suggestion is welcome!

Thanks,
Marco

[code]void write()
{
TFile *f = new TFile(“data.root”, “recreate”);
TString header("…/configs/Config-default.xml");
f->WriteObject(&header, “my_header”);
delete f;
}

void read()
{
TFile *f = new TFile(“data.root”, “read”);
TString *header;
f->GetObject(“my_header”, header);
Printf("%s", header->Data());
}[/code][quote]root [1] write()
root [2] read()
…/configs/Config-default.xml[/quote]
see in UserGuide chapter Input/Output

Jan

Many thanks for your help!

Marco