title: How to skip header row in csv using C++
body: <p>In my scenario,I need to create a parameters file using CSV .Every row means a config-data,the first field of the row treated as the header,using as a identifier. The format of CSV like below will be easy for me to parse:</p>
  
  <pre><code>1,field1,field2,field3,field4　// 1 indicated the TARGET that the other fields will be writted to.
  1,field1,field2,field3,field4
  2,field1,field2,field3,field4
  2,field1,field2,field3,field4........
  </code></pre>
  
  <p>But it's not friendly to users.So,I define a csv file like below:</p>
  
  <pre><code>HeaderLine_Begin,1
  field1,field2,field3,field4
  field1,field2,field3,field4
  HeaderLine_Begin,2
  field1,field2,field3,field4
  field1,field2,field3,field4
  </code></pre>
  
  <p>means,every row is the data will be writted to the target by the HeaderLine_Begin.I just separate the ID from the real data.
  Then,I create a struct like this:</p>
  
  <pre><code>    enum myenum
      {
        ON,OFF,NOCHANGE
      };
  
      struct Setting
      {
        int TargetID;
  
        string field1;
        string field2;
        myenum field3;
        myenum field4;    
      };
  </code></pre>
  
  <p>I knew how to write some code for reading csv line by line like below</p>
  
  <pre><code>filename +=".csv";
  
  std::ifstream file(filename.c_str());
  std::string line;
  
  while ( file.good() )
  {       
      getline ( file, line, '\n' ); // read a line until last 
      if(line.compare(0,1,"#") == 0) // ignore the comment line
          continue;
  
      ParseLine();// DONE.Parse the line if it's header row OR data row           
  }
  
  file.close(); // close file
  </code></pre>
  
  <p>What I want to do is to create a list like vetor settings to keep the data.The flow should be,like,find the first headerID1,then find the next line.If the next line is dataline,treat it as the dataline belong to headerID1.If the next line is another headerID,loop again.</p>
  
  <p>The problem is,there are no such std::getnextline(int lineIndex) for me to fetch the rows after I found the headerRow.  </p>