[ROOT] Saving and loading TExMaps....

From: Edward Moyse (edward.moyse@cern.ch)
Date: Sun Jun 22 2003 - 13:38:53 MEST


Hi,

Can anyone help with this problem? I need to save TExMap objects to disk, and 
read them back later, and I can't find any useful examples, not work it out 
myself.

If I do:

{
	TFile* hfile = new TFile("test.root","RECREATE");
	TExMap* testMap = new TExMap();
	testMap->Add(1,2);
	testMap->Add(2,56);
	testMap->Add(3,256);
	cout << (testMap->GetValue(2))<<endl;;
	cout << (testMap->GetValue(1))<<endl;;
	cout << (testMap->GetValue(100))<<endl;;
	hfile->Write("TestMap", TObject::kSingleKey);
	hfile->Close();
}



Followed by :
{
TFile f2("test.root", "READ");
TExMap *l = (TExMap*)f2.Get("TestMap");
cout << (l->GetValue(2))<<endl;;
cout << (l->GetValue(1))<<endl;;
}

I get the error:
Error: illegal pointer to class object l 0x0 358  FILE:testExMapLoad.C LINE:5
*** Interpreter error recovered ***

I've been trying for horus now, using several different approaches,  and I  
can't work out what's wrong!

Any help would be VERY appreciated!

Cheers,

Ed



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET