Re: retrieving current position in (any) TFile ?

From: Fons Rademakers <Fons.Rademakers_at_cern.ch>
Date: Sun, 15 Nov 2009 04:39:07 +0100


Hi Sebastien,

  the TFile raw mode is mainly/only provided to quickly copy ROOT files using the different TFile plugins, e.g. from dCache to xrootd, etc. TFile is not not a posix interface for ANY kind of raw file. Hence there is no ftell() interface as the locations in the file are determined by the TKeys which determine the seek location. The GetRelOffset() is only used when the ROOT files are part of a zip archive where this offset specifies the files byte offset in the archive.

Cheers, Fons.

Sebastien Binet wrote:

> On Friday 13 November 2009 16:09:09 Rene Brun wrote:
>> Use TFile::GetRelOffset
>> This supports all TFile cases, + the case of ROOT files in archive zip
>> files.
> hum... it seems TFile::GetRelOffset would fit the bill, but it is protected... 
> :}
> 
> cheers,
> sebastien.
> 
>> Sebastien Binet wrote:

>>> hi there,
>>>
>>> to limit nasty surprises users could get (and "effective" side-effects)
>>> when using some function of mine looking like so:
>>>
>>> void do_stuff(TFile* f) {/*play with TFile::Seek*/}
>>>
>>> I'd like to be able to save the current position in the TFile before
>>> doing some work and then restore it before exiting that function.
>>>
>>> I found TFile::Seek being the equivalent of the good ol' POSIX fseek(3),
>>> but what is the equivalent of ftell(3) ?
>>>
>>> cheers,
>>> sebastien.

>
-- 
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 7669640
Received on Sun Nov 15 2009 - 04:39:20 CET

This archive was generated by hypermail 2.2.0 : Mon Nov 16 2009 - 11:50:03 CET