I'm having an issue were I'm trying pulling in data from the .CSV file into the xCol[], yCol[], etc.... Arrays and for some reason they wont be read. The number of lines works fine, so i know the file is being opened. Here is the data format for the csv file (there are 5 columns).
Is that the actual contents of your .CSV file? CSV stands for comma seperated values. I do not see any commas in what you said is the contents. I also do not see comma handling anywhere in your code.
Loop on line 48 most likely ends when the end of file (EOF) is reached. There is nothing to read after the EOF. The ifstream has seekg to move the current position on the stream, for example back to beginning.
However, you don't really need that because you don't use the number_of_lines much.
I would rather write something like:
1 2 3 4 5 6 7 8 9 10
struct Record { int x; int y; int z; double data; double un; };
istream & operator>> ( istream &, Record & );
// use
vector<Record> data;
data.reserve(10000);
Record record;
while ( inFile >> record ) {
data.push_back( record );
}
I got you. I actually tried commenting the part of reading the data and put in the code below and it only reads the first set of numbers "6195152.0000000000".
I was torn between "lets use the default, because user of ignore() must know what the function does" and "explicitly show to the quick reader that we ignore 1, whatever that means".