I have been trying to read a comma separated .txt file into an array and print it to console in C++. The txt file consists of two columns of double type data. For some reason the program runs, but gives blank output in the console. I want to know if I am doing something wrong. So far this is what I have:
while(!getline(is,line).eof()) // what if the stream is in an invalid state?
while(getline(is,line)) // equivalent to -> cplusplus.com/reference/iostream/ios/good/
{
is >> x[i];
is.ignore(numeric_limits<streamsize>::max(), ','); // ignore the comma, #include <limits>
is >> y[i];
i++;
}