There is not directly a workaround for this. I hope Masa and Philippe will
look into this (and the other stream problem).
Cheers, Fons.
LEE, KERRY T. (JSC-SF) (UHCL) wrote:
> Hi Fons,
>
> Thanks for this workaround.
>
> There is another place in my code where I do the following:
>
> fstream fff("mntExHdd",ios_base::in|ios_base_out);
> ....
> Do some reading of the file
> ...
> fff.tellg();
>
> This last line reports a wrong number just like the size was incorrect. Is
> there also a portable way in ROOT to work around this problem?
>
> Thanks
> Kerry
>
>
> -----Original Message-----
> From: Fons Rademakers
> To: LEE, KERRY T. (JSC-SF) (UHCL)
> Cc: ''roottalk_at_pcroot.cern.ch' '; 'Masaharu Goto '; 'Philippe Canal '
> Sent: 5/14/2005 2:30 AM
> Subject: Re: [ROOT] fstream on linuxx8664gcc platform
>
> Hi Kerry,
>
> this will give you file sizes in a portable way in ROOT:
> #include <TSystem.h>
> FileStat_t s;
> gSystem->GetPathInfo("mntExHdd", s)
> s.fSize // contains the size
>
>
> -- Fons
>
>
> LEE, KERRY T. (JSC-SF) (UHCL) wrote:
>
>> >>Hi Fons, >> >>In the meantime, do you know of a workaround I can use to get the file
>>Thanks >>Kerry >> >>-----Original Message----- >>From: Fons Rademakers >>To: LEE, KERRY T. (JSC-SF) (UHCL) >>Cc: 'roottalk_at_pcroot.cern.ch'; Masaharu Goto; Philippe Canal >>Sent: 5/13/2005 7:29 PM >>Subject: Re: [ROOT] fstream on linuxx8664gcc platform >> >>Hi Kerry, >> >> I see the same problem on my AMD64. Looks like a CINT issue. I'll >>forward >>it to Masa. >> >>Cheers, Fons. >> >> >> >>LEE, KERRY T. (JSC-SF) (UHCL) wrote: >> >> >>>Dear Root Team, >>> >>>I have transferred some code from a linuxicc platform ROOT version >> >>4.02/00 >> >> >>>to linuxx8664gcc ROOT version 4.04/02 and it crashed due to incorrect >>>determination of the filesize using fstream. Here is a sample code >> >>that >> >> >>>reproduces the problem, where you just put a file in ascii format in >> >>place >> >> >>>of "mntExHdd". The correct filesize in my case is 105bytes. >>> >>>//TestStream.C >>>{ >>>TString FileName="mntExHdd"; >>>fstream fff(FileName,ios_base::in); >>>if(fff.good()){ >>> fff.seekg(0,ios_base::end); >>> int FileSize = fff.tellg(); >>> cout<<"FileSize="<<FileSize<<endl; >>> fff.seekg(0,ios_base::beg); >>>} >>>fff.close(); >>>} >>> >>>The results from linuxicc >>> >>> ******************************************* >>> * * >>> * W E L C O M E to R O O T * >>> * * >>> * Version 4.02/00 17 December 2004 * >>> * * >>> * You are welcome to visit our Web site * >>> * http://root.cern.ch * >>> * * >>> ******************************************* >>> >>>FreeType Engine v2.1.3 used to render TrueType fonts. >>>Compiled for linuxicc with thread support. >>> >>>CINT/ROOT C/C++ Interpreter version 5.15.159, Nov 14 2004 >>>Type ? for help. Commands must be C++ statements. >>>Enclose multiple statements between { }. >>>root [0] .x TestStream.C >>>FileSize=105 >>> >>> >>>The Results from linuxx8664gcc >>> >>> ******************************************* >>> * * >>> * W E L C O M E to R O O T * >>> * * >>> * Version 4.04/02 9 May 2005 * >>> * * >>> * You are welcome to visit our Web site * >>> * http://root.cern.ch * >>> * * >>> ******************************************* >>> >>>Compiled for linuxx8664gcc with thread support. >>> >>>CINT/ROOT C/C++ Interpreter version 5.15.169, Mar 14 2005 >>>Type ? for help. Commands must be C++ statements. >>>Enclose multiple statements between { }. >>>root [0] .x TestStream.C >>>FileSize=7470896 >>> >>> >>> >>> >>>Thanks >>>Kerry >> >>
-- 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://www.rademakers.org/fons/ Fax: +41 22 7679480Received on Tue May 17 2005 - 23:48:14 MEST
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:08 MET