Hey everybody!

I still have not much experience with reading files. Currently I am
trying to read in something like this
6
6
6
0 0.225 0.45 0.675 0.9 1.125
-0.0375 0.0375 0.1125 0.1875 0.2625 0.3375
-0.0375 0.0375 0.1125 0.1875 0.2625 0.3375
   0    0 0 0 0 0 0 0
   1    0 0 -0.1425027632 
from a file "InFile1". I'd like to read in the first three numbers,
(which works just fine) then ignore the next three lines (which I
could not find out how to do properly) and the continue reading (also
no problem).

Here's some code I have so far:

double num; 
int dim[3];

in.open(InFile1.c_str(),ios::in);
if ( ! in ) {
 cout << "Error: Can't open the file named "<<InFile1<<".\n";
                  exit(1);
                }
in >> dim[0] >> dim[1] >> dim[2];  

   while ( !in.eof() ) { // keep reading until end-of-file
      in >> num;
     cout << "The next number is " << num << endl;
   }
in.close();


Obviously, this is only the reading. In know about the function
ignore() -> in.ignore(#characters), but the file is not fixed so the
number of characters that I'd like to ignore in each of the three
lines is variable. 

Isn't there some function with which I could just march on to the next
line?

Thanks in advance,
Margrit

Reply via email to