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:
As you might expect, this stores the entire row (including unwanted data from column one) as opposed to just the data in column two.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(); . . .
Any help or ideas greatly appreciated!



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.