a) Use seekg() if you know position where you should start rading from
b) Use getline() to some temporary variable as many times, as there header lines
#include <iostream>
#include <fstream>
#include <string>
int main()
{
std::ifstream file( "myfile.txt" ) ;
std::string throw_it_away ;
// for each phase
while( std::getline( file, throw_it_away )
&& std::getline( file, throw_it_away ) ) // throw away the first two lines
{
// read in name, age, salary in a loop
std::string name ;
int age ;
double salary ;
while( file >> name >> age >> salary )
{
// do whatever is needed with name, age and salary
}
// reset the failed state of the stream
file.clear() ;
}
}