[ROOT] ifstream question

From: Varlen Grabski (grabski@fisica.unam.mx)
Date: Mon Sep 08 2003 - 21:09:00 MEST


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