I have a CSV file with a bunch of columns, but I only need the information for the 11th column. How do I read through each line and skip to the 11th column in each line? I'm struggling to find clear information on how to read files in c++. This is what I have so far:
std::string readStock(std::string fileName){
std::vector<double> ticker; //create vector
std::ifstream f(fileName, std::ios::in|std::ios:: binary|std::ios::ate);
if(f.is_open()){
std::string str;
getline(f,str); //skip the first row
while(getline(f,str)){ //goes through each like
std::istringstream iss(str);
std::string skip;
for(int i=1;i<=11;++i){ //skips until we get to the column that we want
std::getline(f,skip, ','))
}
Aucun commentaire:
Enregistrer un commentaire