Re: [ROOT] ifstream question

From: Masaharu Goto (MXJ02154@niftyserve.or.jp)
Date: Tue Sep 09 2003 - 15:44:47 MEST


Hello Varlen,

Thank you for reporting this problem. This occurs because
streampos is typedefed differently between old and new 
gcc.  Before it was 
   typedef long streampos;
Now, it is
   typedef fpos<mbstate_t> streampos;
And  conversion operator  fpos<mbstate_t>::operator long()
was missing in my gcc3 definition.  

I'll fix this problem in next release.   Meanwhile, you can
workaround the problem by defining locate0-2 as streampos;

   streampos locate0;
   streampos locate1;
     ...

Masa Goto



----- Original Message ----- 
From: "Varlen Grabski" <grabski@fisica.unam.mx>
To: <roottalk@pcroot.cern.ch>
Sent: Tuesday, September 09, 2003 4:09 AM
Subject: [ROOT] ifstream question


> Hi Rooters,
> 
> My macro which worked fine with root 3.03/08, now has some problem with
> new version of the root 3.05/07.Seems that seekg() doesn't change
> position in the file. For the simple program is listed below i have got
> strange result.
> 
> indat.open(filename[kz], ios_base::in);  
> if(!indat.good())
>    {
>     cerr << "File open problem" << endl;
>    }
>   long locate0 =  0;
>   locate0 = indat.tellg();
>   cout << "locate0 : " << locate0  << endl;
>   indat.read(curr, 20);
>   long locate1 = 0;
>   locate1 = indat.tellg();
>   cout << "locate1 : " << locate1  << endl;
>   long locate2 = 0;
>   indat.seekg(0,ios_base::end);
>   locate2 = indat.tellg();
>   cout << "locate2 : " << locate2  << endl;
> 
> The results are:
> 
> locate0 : 146521344
> locate1 : 146525216
> locate2 : 146525248
> 
> What am I doing wrong ?
> 
> Thanks in advance,
> 
> Varlen
> 
> 



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