just started learning C++ recently. I am trying to read an ics file in the format:
BEGIN:VEVENT
UID:2179:203860:1:002:1:person
DTSTAMP:20170921T080000Z
SUMMARY;LANGUAGE=en-ca:BIG CITY
LOCATION:CANADA
DTSTART;TZID=Eastern Standard Time:20170914T183000
DTEND;TZID=Eastern Standard Time:20170914T203000
RRULE:FREQ=WEEKLY;UNTIL=20171201T235959;BYDAY=TH
CLASS:PUBLIC
PRIORITY:5
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0
END:VEVENT
What I did was read each line and called a string to find the specific delimiter, get the part right after it, and push it into a vector. Here is my method to read the file:
void SimpleCalendar::initialize(){
int counter = 0;
string getLine;
ifstream readFile;
readFile.open("cal.ics");
if(readFile.fail()){
throw FileException("Error! Cannot open the file.");
}
while(!readFile.eof()){
readFile >> getLine;
size_t summ = getLine.find("SUMMARY;LANGUAGE=en-ca:");
if (summ != string::npos){
course.push_back(getLine.substr(summ+1));
cout << course[counter] << endl;
counter++;
}
}
What it should output is: BIG CITY
instead I get this -> SUMMARY;LANGUAGE=en-ca:BIG