accessing a new directory

From: mayer@ik1.fzk.de
Date: Fri Oct 02 1998 - 14:24:25 MEST


Dear rooters

I have a problem accessing a newly created directory. The following macro
and its output shows the problem. However first closing and then reopening
the file does work. I use redhat 4.2 with root version 2.011. 
The problem however does not appear under DEC/OSF1. 

Thanks in advance     
                    Hajo.

//--------> t2.C this does not work
{
gROOT.Reset();
file = new TFile("test.root","new");
gDirectory.pwd();
gDirectory.mkdir("ku","Die Kunst");
gDirectory.pwd();
gDirectory.ls();

TObject *obj = gDirectory->Get("ku;1");
printf("%s \n",obj->GetTitle());
gDirectory.pwd();
gDirectory.ls();

}


root [0] .x t2.C
test.root:/
test.root:/
TFile**         test.root
 TFile*         test.root
  TDirectory*           ku      Die Kunst
  KEY: TDirectory       ku;1    Die Kunst
Die Kunst
test.root:/
TFile**         test.root
 TFile*         test.root

 *** Break *** segmentation violation


//-------> t1.C  this does work
{
gROOT.Reset();
file = new TFile("test.root","new");
gDirectory.pwd();
gDirectory.mkdir("ku","Die Kunst");
gDirectory.pwd();
gDirectory.ls();

file.Close();
file = new TFile("test.root");
gDirectory.pwd();
gDirectory.ls();

TObject *obj = gDirectory->Get("ku;1");
printf("%s \n",obj->GetTitle());
gDirectory.pwd();
gDirectory.ls();

}


root [2] .x t1.C
test.root:/
test.root:/
TFile**         test.root
 TFile*         test.root
  TDirectory*           ku      Die Kunst
  KEY: TDirectory       ku;1    Die Kunst
test.root:/
TFile**         test.root
 TFile*         test.root
  KEY: TDirectory       ku;1    Die Kunst
Die Kunst
test.root:/
TFile**         test.root
 TFile*         test.root
  TDirectory*           ku      Die Kunst
  KEY: TDirectory       ku;1    Die Kunst



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET