title: parse huge csv file with C++
body: <p>I order to simulate my network I am using a trace file (csv file) with a size between 5 to 30 GB. 
  The csv file is a row based, where each row contains multiple fields delimited by a space and forming teh information to form a network packet: </p>
  
  <pre><code>3     53      4    12    1     1  2  6
  </code></pre>
  
  <p>Since the file's size could reach several GBs (millions of lines), is it better to divided it into small chunks myfile00.csv, myfile01.csv..., or I can process the entire file on the hard drive without being loaded into the memory?
  I want to read the file line by line at a specific time, which is the clock cycle of the simulation, and get all information in the line to create an omnet++ message.</p>
  
  <pre><code>packet MyTrace::getpacket() {
  int id; // first field
  int cycle; // second field
  int source; // third field
  int destination; // fourth field
  int numberofDep; // fifth field
  std::list&lt;int&gt; listofDep; // remaining fields
  
  if (!traceFile.is_open()) {
   // get id
   // get cycle
   // ....
  }
  </code></pre>
  
  <p>Any suggestion would be helpful.  </p>
  
  <p>EDIT:</p>
  
  <pre><code>  string line;
    ifstream myfile ("BlackSmall.csv");
      int currentline=0 ;
    if (myfile.is_open())
    {
     while (getline(myfile, line)) {  
  
        istringstream ss(line);
        string request;
        int id, cycle, source , dest, srcType, destType, packetSize, dependency;
        int listdep;
        std::list&lt;int&gt; dep; 
                ss &gt;&gt; id; 
                ss&gt;&gt; cycle; 
                ss&gt;&gt; source; 
                ss&gt;&gt; dest;
                ss&gt;&gt;request;
                ss&gt;&gt; srcType;
                ss&gt;&gt; destType;
                ss&gt;&gt; packetSize;
                ss&gt;&gt; dependency; 
                while (ss &gt;&gt; listdep) dep.push_back(listdep);
             // Create my packet
  
      }
      myfile.close();
      }
    else cout &lt;&lt; "Unable to open file"; 
  </code></pre>
  
  <p>With the above code, I can get all information that I need from a line.
  The problem is that I need to use this code inside a class, which when I call it returns just one line's information. Is there a way how to point to a specific line when I call this class?   </p>