I want to read a .csv file with two columns into two variables. The variables will then be used a couple of calculations, after which a value will be writen into a third column.
If you want to use std::getline() then remember that the first column ends with a comma ',' but the second column does not, it ends with a line end.
Also do you want to read these as strings or numbers? The data looks a bit like its a float and an integer. If that is the case you might want to use >>.
#include <fstream>
#include <iostream>
int main()
{
std::ifstream ifs("route.csv");
float f; // first column
int i; // second column
char c; // to read the comma
// put the reads in the while condition if possible
while(ifs >> f >> c >> i)
{
// that way you know the read was a success
// if you end up here
std::cout << "f: " << f << std::endl;
std::cout << "i: " << i << std::endl;
}
}