11/29/2010 S 2907 1
11/29/2010 S 9673 4
11/30/2010 A 4321 30
11/31/2010 S 9673 12
12/01/2010 N 5789 wind_chimes 13.54 17.83
12/02/2010 S 5140 5
im trying to get only the date, the letter, and the 4 numbers. but everytime i try and get the information it skips the last line anyone tell me what im doing wrong?
You read a file that is made out of int'/'int'/'int'/'charintint however 5th line is int'/'int'/'int'/'charint string floatfloat. When you tell stream to read an int but there is a string, an error occurs. If you don't want to read anything after the four digit number, use infile2.ignore(std::numeric_limits<std::streamsize>::max(), '\n');. If you find that confusing, you could also red a rubbish string with getline.
by the way, std::numeric_limits needs #include <limits>
11/29/2010 S 2907 1
11/29/2010 S 9673 4
11/30/2010 A 4321 30
11/31/2010 S 9673 12
12/01/2010 N 5789 wind_chimes 13.54 17.83
12/02/2010 S 5140 5
i read in the file and yes it worked (thank you), however now instead of reading the second line which is 11/29/2010 it skips it and repeats the last line. any idea why?