mardi 19 février 2019

trying to move to next line when reading file in c++

CLICK FOR IMAGE OF MY CODE

Im trying to read information from a text file opened in fstream. The first time the for bucle runs, the program reads the right information. But when i try to skip to the next line using the getline(file, line2), the line2 is not read. I get a line2 = "" and then the same line is read for all iterations of the for bucle. Anyone know why the second getline doesnt read any data? Or if there is an easier way to skip to the next line after using "file >> "?

Thanks in advance,

Gab

Aucun commentaire:

Enregistrer un commentaire