title: Reading a specific column in a .tsv file
body: <p>I'm trying to read data from a .tsv file into a vector. The file is structured something like this:</p>
  
  <pre><code>A    B
  1    2
  2    4
  6    8
  </code></pre>
  
  <p>I want to ask what column the program should read, and then push the values from that column into a vector. My code so far is this:</p>
  
  <pre><code>int main() {
  
  string filename, column, headerLine;
  vector&lt;double&gt; data, tempData;
  int numColumn;
  
  ifstream dataFile;
  cout &lt;&lt; "enter a filename" &lt;&lt; endl;
  cin &gt;&gt; filename;
  dataFile.open(filename);
  cout &lt;&lt; "enter a column name" &lt;&lt; endl;
  cin &gt;&gt; column;
  cout &lt;&lt; "reading column " &lt;&lt; column &lt;&lt; " from " &lt;&lt; filename;
  getline(dataFile, headers);
  
  //here's where I feel stuck
  
  }
  </code></pre>
  
  <p>If I can get the headers into a vector called headersList and then do something similar for the data rows, I would be able to do this:</p>
  
  <pre><code>for(int i = 0; i &lt; headersList.size(); i++) {
      if(headersList[i] == column) {
          numColumn = i;
      }
  }
  while(!dataFile.eof()) {
      //some way of getting the data points into a vector called tempData
      data.push_back(tempData[numColumn]);
      tempData.clear();
  }
  </code></pre>
  
  <p>I'd really appreciate some help</p>