#include <iostream>
#include <fstream>
#include <string>
#include <vector>
int main()
{
std::vector<std::string> someString;
std::vector<double> someDouble;
std::vector<double> someOtherDouble;
std::ifstream file("test.txt");
std::string s;
double d1, d2;
char ch;
while( file >> std::ws // skip leading whitespace
&& getline(file, s, ',') // read until comma into string s
&& file >> d1 >> ch >> d2
&& ch == ',' ) // make sure it was a comma
{
someString.push_back(s);
someDouble.push_back(d1);
someOtherDouble.push_back(d2);
std::cout << "saving " << s << " : " << d1 << " : " << d2 << '\n';
}
}
or you could make the parsing a bit easier by defining comma as whitespace.. you may not want to do that if you're "new to C++ and programming", but do keep in mind that it's available