Hi Tom,
the global errno is not exported via a dictionary to CINT, hence this cannot be used in a script, only in compiled code.
Cheers, Fons.
On 17/02/2011 17:17, Tom Roberts wrote:
> No, the code quoted below does not work -- the errno it references does not
> change:
>
> root [2] errno=0
> Warning: Automatic variable errno is allocated (tmpfile):1:
> (const int)0
> root [3] f1=new TFile("g4beamline.root") // file exists
> (class TFile*)0x254ede0
> root [4] errno
> (int)0
> root [5] f1->Close()
> root [6] f1=new TFile("does not exist")
> Error in <TFile::TFile>: file does not exist does not exist
> (class TFile*)0x254f490
> root [7] f1->IsZombie()
> (const Bool_t)(1)
> root [8] errno
> (int)0
>
> The clue is the warning "Automatic variable errno is allocated", indicating
> this variable errno is UNRELATED to the errno used by the stdio library.
>
> Doing "#include <stdio.h>" beforehand does not help. Doing "extern int
> errno" beforehand does not help. Using std::errno does not warn about
> allocating an automatic variable, but also does not change from 0 when
> calling TFile("does not exist").
>
> I suppose it is possible that the code quoted below works when compiled
> with "#include <stdio.h>", but relying on that in a Cint environment seems
> risky to me....
>
> Comment: the error message following root[6] above should put the filename
> in quotes (filenames can contain spaces).
>
> Comment: Are there really two different "roottalk" mailing lists? If not,
> why the different email addresses?
>
>
> Tom Roberts
>
>
>
> On 2/17/11 2/17/11 - 3:50 AM, Fons Rademakers wrote:
>> Hi Thiemo,
>>
>> yes that's fine.
>>
>> Cheers, Fons.
>>
>>
>> On 17/02/11 10:17, Thiemo Nagel wrote:
>>> Dear Konstantin, Fons,
>>>
>>> On 02/16/2011 09:09 PM, Konstantin Olchanski wrote:
>>>> You can also cheat:
>>>>
>>>> errno = 0;
>>>> TFile *f = new TFile( argv[1] );
>>>> if (errno != 0)
>>>> printf("system error %d (%s) somewhere inside TFile::Open", errno,
>>>> strerror(errno));
>>>
>>> very interesting! If it is ok with the ROOT guys, I'd use this for the hadd
>>> -k option.
>>>
>>> Cheers,
>>> Thiemo
>>
>
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers_at_cern.ch Phone: +41 22 7679248 WWW: http://fons.rademakers.org Fax: +41 22 7669640Received on Thu Feb 17 2011 - 17:30:40 CET
This archive was generated by hypermail 2.2.0 : Thu Feb 17 2011 - 23:50:01 CET