1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
while (getline(*inFile, line))
{
int dayStart; // Expect 1 - 31
int monthStart; // Expect 1 - 12
int yearStart; // Expect 2017 or larger
int hourStart; // expect 0 - 23
int minuteStart; // expect 0 - 59
int secondStart; // expect 0 - 59
int dayEnd; // expect 1 - 31
int monthEnd; // Expect 1 - 12
int yearEnd; // Expect 2017 or larger
int hourEnd; // Expext 0 - 23
int minuteEnd; // Expect 0 - 59
int secondEnd; // expect 0 - 59
int playerNumber; // expect 0 - 99
string playerName;
string value;
stringstream linestream(line);
//// used for testing:
// cout << line << endl;
getline(linestream, value, ',');
stringstream temp1(value);
temp1 >> dayStart;
getline(linestream, value, ',');
stringstream temp2(value);
temp2 >> monthStart;
getline(linestream, value, ',');
stringstream temp3(value);
temp3 >> yearStart;
getline(linestream, value, ',');
stringstream temp4(value);
temp4 >> hourStart;
getline(linestream, value, ',');
stringstream temp5(value);
temp5 >> minuteStart;
getline(linestream, value, ',');
stringstream temp6(value);
temp6 >> secondStart;
getline(linestream, value, ',');
stringstream temp7(value);
temp7 >> dayEnd;
getline(linestream, value, ',');
stringstream temp8(value);
temp8 >> monthEnd;
getline(linestream, value, ',');
stringstream temp9(value);
temp9 >> yearEnd;
getline(linestream, value, ',');
stringstream temp10(value);
temp10 >> hourEnd;
getline(linestream, value, ',');
stringstream temp11(value);
temp11 >> minuteEnd;
getline(linestream, value, ',');
stringstream temp12(value);
temp12 >> secondEnd;
getline(linestream, value, ',');
stringstream temp13(value);
temp13 >> playerNumber;
getline(linestream, playerName, ',');
record.startTime.setTime(hourStart, minuteStart, secondStart);
record.endTime.setTime(hourEnd, minuteEnd, secondEnd);
record.startDate.day = dayStart;
record.startDate.month = monthStart;
record.startDate.year = yearStart;
record.endDate.day = dayEnd;
record.endDate.day = monthEnd;
record.endDate.day = yearEnd;
record.playerNumber = playerNumber;
record.playerName = playerName;
//// used for testing:
// cout << record.startTime.getHour();
}
| |