I'm trying to do a simple getline
from a filestream and then store the different input into different arrays.
The input file is something like this.
Course Of Sales Time,Price ($),Volume,Value ($),Condition 10/10/2013 04:57:27 PM,5.81,5000,29050.00,LT XT 10/10/2013 04:48:05 PM,5.81,62728,364449.68,SX XT 10/10/2013 04:10:33 PM,.00,0,.00,
Note that the first two lines are redundant and should be ignored. All data should be stored in their respective arrays like time[i], price[i].
string datefield;
int count = 0;
string date[5000];
float pricefield;
float price [5000];
int volume[5000];
float value[5000];
string condition[5000];
int i = 0;
while (!infile.eof()) {
count++;
getline(infile,datefield);
while (count >= 2) {
getline(infile,date[i], ',');
infile >> price[i] >> volume[i];
i++;
break;
}
}
The problem here is, no input is going into volume[i].