Storing columns of numerical data from csv files to a vector
Hello, I have a csv file with two columns, one contains the date and time and the other contains numerical data. How would I get column two only (numerical data) stored in a vector?
I currently have:
Code:
.
.
.
int main(int argc, char *argv[])
{
string filename, line;
cout<<"Enter the filename of the wind speed data "<<endl;
getline (cin,filename);
ifstream inFile;
inFile.open(filename.c_str());
if (!inFile){
cout<<"Error opening - " <<filename<<endl;
return -1;
}
while(!inFile.eof())
{
getline(inFile,line);
stringstream lineStream(line);
string bit;
vector<string>DataStore;
while(getline(lineStream, bit, ',')){
DataStore.push_back(bit);
}
inFile.close();
.
.
.
As you might expect, this stores the entire row (including unwanted data from column one) as opposed to just the data in column two.
Any help or ideas greatly appreciated!