Having issues with adding a csv file seperated by , into a protein object. Any help would be greatly appreciated.
vector<Protein> proteins;
Protein prot;
// load disprot database of intrinsically disordered proteins
std::ifstream reading;
reading.open("C:\Users\james\CLionProjects\untitled1\disprot.csv");
std::string line, col;
if (reading.is_open()){
while (reading.good()){
std::getline(reading, line);
std::stringstream ss(line);
while(std::getline(ss, col, ',')){
Protein temp(ss.get(), ss.get(),ss.get(),col.get_allocator())
proteins.push_back(prot);
}
}
reading.close();
}
else if(!reading.is_open()) throw std::runtime_error("Could not open file");
question from:
https://stackoverflow.com/questions/65831116/adding-objects-into-vectors-when-reading-in-from-a-file 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…