RE: [ROOT] G__unloadfile() / Seg Fault

From: Philippe Canal (pcanal@fnal.gov)
Date: Wed Oct 15 2003 - 19:37:08 MEST


Hi,

The problem stems from the lines:

Char_t title[5];
sprintf(title,"simulate_mode%d_nev%d.out",mode,nevents);
....
sprintf(title,"simulate_mode%d_nev%d.root",mode,nevents);

You are trying to fit more than 5 characters in a 5 characters array.
This leads to 'unspecified' behavior (in particular the seg fault you see).

You can use instead:
    ofstream fallout(Form("simulate_mode%d_nev%d.out",mode,nevents),
ios::out);
    TFile *froot= new
TFile(Form("simulate_mode%d_nev%d.root",mode,nevents),"RECREATE");
or on of the many other solution (use TString, std::string or increase the
array size).

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Federico Roncarolo
Sent: Tuesday, October 14, 2003 9:53 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] G__unloadfile() / Seg Fault


Dear Rooters,

I'm running the simple marco you find attached, on linux RH7.3 with
ROOT Version   3.03/09 18.
It works fine, but if I try to run it again I get

!!!Dictionary position not recorvered because G__unloadfile() in macro!!!

and if I try to quit I get a segmentation fault...

I looked in the roottalk, but the only similar trouble looked related to
some afs accesses. I'm running it from my home which is on afs, but also
running it form my local / I get the same problem.

Could you help me?

	Thanks a lot,
	Federico

--
__________________________________________________
Federico Roncarolo     federico.roncarolo@cern.ch
                            alchemist@infinito.it
CERN AB/BDI 865 1-A27

Tel:
+41.(0)22.7675611	Work
+41.(0)79.6982190 	GSM
+41.(0)22.3105608 	Home
__________________________________________________



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